Hey guys! So I'm still playing around with TCPDF. Basically I'm trying to generate a report using TCPDF, and then send it using MIME as an attachment.
The problem I'm having now is creating the PDF on my local server, for subsequent attachment.
I've run this code:
<?php
//Creates an example PDF TEST document using TCPDF
require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator('Stock Program v. 1.1');
$pdf->SetAuthor('xxx');
$pdf->SetTitle('3rd Quarter Stock Holdings Summary, xxx'); //maybe this can be Stock Report 2nd quarter...have a variable in there.
$pdf->SetSubject('Stock Report');
$pdf->SetHeaderData('NovaCrayon.jpg', 50);// This is the header data.
$pdf->SetMargins(25.4, 25.4, 25.4, false);
$pdf->SetHeaderMargin(0);
//image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetFont('helvetica', '', 14, '', true);
$pdf->AddPage();
$html = <<<EOD
TEST
EOD;
$html2 = 'Now We Are Getting Fancy';
// Print text using writeHTMLCell()
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html2, $border=0, $ln=1, $fill = 0, $resth=true, $align='', $autopadding=true);
// Close and output PDF document
$testName = 'zzTest PDF Local';
$pdf->Output($testName, 'F');
?>
So if you're not familiar with TCPDF, when I run $pdf->Output($testName, 'F'), the option F is supposed to save to a local server file with the name given. However, when I run the script, this is the error I receive:
Warning: fopen(zzTest PDF Local) [function.fopen]: failed to open stream: Permission denied in /var/www/tcpdf/tcpdf.php on line 7488
TCPDF ERROR: Unable to create output file: zzTest PDF Local
I'm sure this is a combination of my newbness, both with Ubuntu and with PHP / TCPDF. What would you recommend I do to cure this error? Thanks for your time!
-slight