diff --git a/FAQ.htm b/FAQ.htm index a4abc2c..6379a4b 100644 --- a/FAQ.htm +++ b/FAQ.htm @@ -46,13 +46,13 @@

FAQ

2. I get the following error when I try to generate a PDF: Some data has already been output, can't send PDF file

You must send nothing to the browser except the PDF itself: no HTML, no space, no carriage return. A common case is having extra blank at the end of an included script file.
-If you can't figure out where the problem comes from, this other message appearing just before will help you:

-Warning: Cannot modify header information - headers already sent by (output started at script.php:X)
+The message may be followed by this indication:

-It means that script.php outputs something at line X. Go to that line and fix it. -In case the message doesn't show, check if PHP warnings are enabled. If they are not, enable them. If they are, -try adding this at the very beginning of your script: +(output started at script.php:X)
+
+which gives you exactly the script and line number responsible for the output. If you don't see it, +try adding this line at the very beginning of your script:
ob_end_clean();
@@ -60,15 +60,14 @@

FAQ

  • 3. Accented letters are replaced with some strange characters like é.

    -Don't use UTF-8 with the standard fonts; they expect text encoded in ISO-8859-1 or windows-1252. -You can use utf8_decode() to perform a conversion to ISO-8859-1: +Don't use UTF-8 with the standard fonts; they expect text encoded in windows-1252. +You can perform a conversion with iconv:
    -
    $str = utf8_decode($str);
    +
    $str = iconv('UTF-8', 'windows-1252', $str);
    -But some characters such as Euro won't be translated correctly. If the iconv extension is available, the -right way to do it is the following: +Or with mbstring:
    -
    $str = iconv('UTF-8', 'windows-1252', $str);
    +
    $str = mb_convert_encoding($str, 'windows-1252', 'UTF-8');
    In case you need characters outside windows-1252, take a look at tutorial #7 or tFPDF. diff --git a/changelog.htm b/changelog.htm index fb4d470..b296def 100644 --- a/changelog.htm +++ b/changelog.htm @@ -11,6 +11,14 @@

    Changelog

    +
    v1.85 (2022-11-10)
    +
    +- Removed deprecation notices on PHP 8.2.
    +- Removed notices when passing null values instead of strings.
    +- The FPDF_VERSION constant was replaced by a class constant.
    +- The creation date of the PDF now includes the timezone.
    +- The content-type is now always application/pdf, even for downloads.
    +
    v1.84 (2021-08-28)
    - Fixed an issue related to annotations.
    @@ -21,7 +29,7 @@

    Changelog

    v1.82 (2019-12-07)
    -- Removed a deprecation notice under PHP 7.4.
    +- Removed a deprecation notice on PHP 7.4.
    v1.81 (2015-12-20)
    @@ -94,7 +102,7 @@

    Changelog

    - Type1 font support.
    - Added Baltic encoding.
    -- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5:
      * The line thickness was too large when printed under Windows 98 SE and ME.
      * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.
    +- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5:
      * The line thickness was too large when printed on Windows 98 SE and ME.
      * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.
    - It's no longer necessary to set the decimal separator as dot to produce valid documents.
    - The clickable area in a cell was always on the left independently from the text alignment.
    - JPEG images in CMYK mode appeared in inverted colors.
    diff --git a/doc/__construct.htm b/doc/__construct.htm index 5d76dd2..f0f3520 100644 --- a/doc/__construct.htm +++ b/doc/__construct.htm @@ -53,9 +53,9 @@

    Parameters

    Example

    -Example with a custom 100x150 mm page size: +Document with a custom 100x150 mm page size:
    -
    $pdf = new FPDF('P','mm',array(100,150));
    +
    $pdf = new FPDF('P', 'mm', array(100,150));

    Index
    diff --git a/doc/acceptpagebreak.htm b/doc/acceptpagebreak.htm index 79c4a49..bb1aaa1 100644 --- a/doc/acceptpagebreak.htm +++ b/doc/acceptpagebreak.htm @@ -19,40 +19,40 @@

    Example

    class PDF extends FPDF
     {
    -var $col = 0;
    +    protected $col = 0;
     
    -function SetCol($col)
    -{
    -    // Move position to a column
    -    $this->col = $col;
    -    $x = 10+$col*65;
    -    $this->SetLeftMargin($x);
    -    $this->SetX($x);
    -}
    -
    -function AcceptPageBreak()
    -{
    -    if($this->col<2)
    +    function SetCol($col)
         {
    -        // Go to next column
    -        $this->SetCol($this->col+1);
    -        $this->SetY(10);
    -        return false;
    +        // Move position to a column
    +        $this->col = $col;
    +        $x = 10 + $col*65;
    +        $this->SetLeftMargin($x);
    +        $this->SetX($x);
         }
    -    else
    +
    +    function AcceptPageBreak()
         {
    -        // Go back to first column and issue page break
    -        $this->SetCol(0);
    -        return true;
    +        if($this->col<2)
    +        {
    +            // Go to next column
    +            $this->SetCol($this->col+1);
    +            $this->SetY(10);
    +            return false;
    +        }
    +        else
    +        {
    +            // Go back to first column and issue page break
    +            $this->SetCol(0);
    +            return true;
    +        }
         }
     }
    -}
     
     $pdf = new PDF();
     $pdf->AddPage();
    -$pdf->SetFont('Arial','',12);
    +$pdf->SetFont('Arial', '', 12);
     for($i=1;$i<=300;$i++)
    -    $pdf->Cell(0,5,"Line $i",0,1);
    +    $pdf->Cell(0, 5, "Line $i", 0, 1);
     $pdf->Output();

    See also

    diff --git a/doc/addfont.htm b/doc/addfont.htm index b1bca0c..128e59c 100644 --- a/doc/addfont.htm +++ b/doc/addfont.htm @@ -41,11 +41,11 @@

    Parameters

    Example

    -
    $pdf->AddFont('Comic','I');
    +
    $pdf->AddFont('Comic', 'I');
    is equivalent to:
    -
    $pdf->AddFont('Comic','I','comici.php');
    +
    $pdf->AddFont('Comic', 'I', 'comici.php');

    See also

    SetFont diff --git a/doc/aliasnbpages.htm b/doc/aliasnbpages.htm index 3768cf7..d675efb 100644 --- a/doc/aliasnbpages.htm +++ b/doc/aliasnbpages.htm @@ -22,15 +22,15 @@

    Example

    class PDF extends FPDF
     {
    -function Footer()
    -{
    -    // Go to 1.5 cm from bottom
    -    $this->SetY(-15);
    -    // Select Arial italic 8
    -    $this->SetFont('Arial','I',8);
    -    // Print current and total page numbers
    -    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
    -}
    +    function Footer()
    +    {
    +        // Go to 1.5 cm from bottom
    +        $this->SetY(-15);
    +        // Select Arial italic 8
    +        $this->SetFont('Arial', 'I', 8);
    +        // Print current and total page numbers
    +        $this->Cell(0, 10, 'Page '.$this->PageNo().'/{nb}', 0, 0, 'C');
    +    }
     }
     
     $pdf = new PDF();
    diff --git a/doc/cell.htm b/doc/cell.htm
    index d46359a..8b69ba5 100644
    --- a/doc/cell.htm
    +++ b/doc/cell.htm
    @@ -81,11 +81,11 @@ 

    Parameters

    Example

    // Set font
    -$pdf->SetFont('Arial','B',16);
    +$pdf->SetFont('Arial', 'B', 16);
     // Move to 8 cm to the right
     $pdf->Cell(80);
     // Centered text in a framed 20*10 mm cell and line break
    -$pdf->Cell(20,10,'Title',1,1,'C');
    +$pdf->Cell(20, 10, 'Title', 1, 1, 'C');

    See also

    SetFont, diff --git a/doc/footer.htm b/doc/footer.htm index a3a2018..4398bd8 100644 --- a/doc/footer.htm +++ b/doc/footer.htm @@ -16,15 +16,15 @@

    Example

    class PDF extends FPDF
     {
    -function Footer()
    -{
    -    // Go to 1.5 cm from bottom
    -    $this->SetY(-15);
    -    // Select Arial italic 8
    -    $this->SetFont('Arial','I',8);
    -    // Print centered page number
    -    $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
    -}
    +    function Footer()
    +    {
    +        // Go to 1.5 cm from bottom
    +        $this->SetY(-15);
    +        // Select Arial italic 8
    +        $this->SetFont('Arial', 'I', 8);
    +        // Print centered page number
    +        $this->Cell(0, 10, 'Page '.$this->PageNo(), 0, 0, 'C');
    +    }
     }

    See also

    diff --git a/doc/header.htm b/doc/header.htm index 3c3da96..984fc6a 100644 --- a/doc/header.htm +++ b/doc/header.htm @@ -16,17 +16,17 @@

    Example

    class PDF extends FPDF
     {
    -function Header()
    -{
    -    // Select Arial bold 15
    -    $this->SetFont('Arial','B',15);
    -    // Move to the right
    -    $this->Cell(80);
    -    // Framed title
    -    $this->Cell(30,10,'Title',1,0,'C');
    -    // Line break
    -    $this->Ln(20);
    -}
    +    function Header()
    +    {
    +        // Select Arial bold 15
    +        $this->SetFont('Arial', 'B', 15);
    +        // Move to the right
    +        $this->Cell(80);
    +        // Framed title
    +        $this->Cell(30, 10, 'Title', 1, 0, 'C');
    +        // Line break
    +        $this->Ln(20);
    +    }
     }

    See also

    diff --git a/doc/image.htm b/doc/image.htm index 96ab907..aad4775 100644 --- a/doc/image.htm +++ b/doc/image.htm @@ -87,9 +87,9 @@

    Parameters

    Example

    // Insert a logo in the top-left corner at 300 dpi
    -$pdf->Image('logo.png',10,10,-300);
    +$pdf->Image('logo.png', 10, 10, -300);
     // Insert a dynamic image from a URL
    -$pdf->Image('http://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World',60,30,90,0,'PNG');
    +$pdf->Image('http://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World', 60, 30, 90, 0, 'PNG');

    See also

    AddLink diff --git a/doc/index.htm b/doc/index.htm index f4766ba..211032b 100644 --- a/doc/index.htm +++ b/doc/index.htm @@ -2,11 +2,11 @@ -FPDF 1.84 Reference Manual +FPDF 1.85 Reference Manual -

    FPDF 1.84 Reference Manual

    +

    FPDF 1.85 Reference Manual

    __construct - constructor
    AcceptPageBreak - accept or not automatic page break
    AddFont - add a new font
    diff --git a/doc/output.htm b/doc/output.htm index 229e0a7..8992f93 100644 --- a/doc/output.htm +++ b/doc/output.htm @@ -38,6 +38,15 @@

    Parameters

    The default value is false. +

    Example

    +Save the document to a local directory: +
    +
    $pdf->Output('F', 'reports/report.pdf');
    +
    +Force a download: +
    +
    $pdf->Output('D', 'report.pdf');
    +

    See also

    Close
    diff --git a/doc/setfont.htm b/doc/setfont.htm index a1de05c..072de22 100644 --- a/doc/setfont.htm +++ b/doc/setfont.htm @@ -23,13 +23,12 @@

    Description


    Note: the font definition files must be accessible. They are searched successively in: Example using FPDF_FONTPATH:
    -
    define('FPDF_FONTPATH','/home/www/font');
    +
    define('FPDF_FONTPATH', '/home/www/font');
     require('fpdf.php');
    If the file corresponding to the requested font is not found, the error "Could not include font @@ -66,7 +65,7 @@

    Parameters

    Font size in points.
    The default value is the current size. If no size has been specified since the beginning of -the document, the value taken is 12. +the document, the value is 12.

    Example

    @@ -74,11 +73,11 @@

    Example

    // Times regular 12
     $pdf->SetFont('Times');
     // Arial bold 14
    -$pdf->SetFont('Arial','B',14);
    +$pdf->SetFont('Arial', 'B', 14);
     // Removes bold
     $pdf->SetFont('');
     // Times bold, italic and underlined 14
    -$pdf->SetFont('Times','BIU');
    +$pdf->SetFont('Times', 'BIU');

    See also

    AddFont, diff --git a/doc/write.htm b/doc/write.htm index 0c7914c..42b1c99 100644 --- a/doc/write.htm +++ b/doc/write.htm @@ -32,12 +32,12 @@

    Parameters

    Example

    // Begin with regular font
    -$pdf->SetFont('Arial','',14);
    -$pdf->Write(5,'Visit ');
    +$pdf->SetFont('Arial', '', 14);
    +$pdf->Write(5, 'Visit ');
     // Then put a blue underlined link
    -$pdf->SetTextColor(0,0,255);
    -$pdf->SetFont('','U');
    -$pdf->Write(5,'www.fpdf.org','http://www.fpdf.org');
    +$pdf->SetTextColor(0, 0, 255); +$pdf->SetFont('', 'U'); +$pdf->Write(5, 'www.fpdf.org', 'http://www.fpdf.org');

    See also

    SetFont, diff --git a/fpdf.php b/fpdf.php index efacf7f..2af3176 100644 --- a/fpdf.php +++ b/fpdf.php @@ -2,15 +2,14 @@ /******************************************************************************* * FPDF * * * -* Version: 1.84 * -* Date: 2021-08-28 * +* Version: 1.85 * +* Date: 2022-11-10 * * Author: Olivier PLATHEY * *******************************************************************************/ -define('FPDF_VERSION','1.84'); - class FPDF { +const VERSION = '1.85'; protected $page; // current page number protected $n; // current object number protected $offsets; // array of object offsets @@ -18,6 +17,7 @@ class FPDF protected $pages; // array containing pages protected $state; // current document state protected $compress; // compression flag +protected $iconv; // whether iconv is available protected $k; // scale factor (number of points in user unit) protected $DefOrientation; // default orientation protected $CurOrientation; // current orientation @@ -65,6 +65,7 @@ class FPDF protected $ZoomMode; // zoom display mode protected $LayoutMode; // layout display mode protected $metadata; // document properties +protected $CreationDate; // document creation date protected $PDFVersion; // PDF version number /******************************************************************************* @@ -73,8 +74,6 @@ class FPDF function __construct($orientation='P', $unit='mm', $size='A4') { - // Some checks - $this->_dochecks(); // Initialization of properties $this->state = 0; $this->page = 0; @@ -101,6 +100,7 @@ function __construct($orientation='P', $unit='mm', $size='A4') $this->ColorFlag = false; $this->WithAlpha = false; $this->ws = 0; + $this->iconv = function_exists('iconv'); // Font path if(defined('FPDF_FONTPATH')) { @@ -165,6 +165,8 @@ function __construct($orientation='P', $unit='mm', $size='A4') $this->SetDisplayMode('default'); // Enable compression $this->SetCompression(true); + // Metadata + $this->metadata = array('Producer'=>'FPDF '.self::VERSION); // Set default PDF version number $this->PDFVersion = '1.3'; } @@ -232,31 +234,31 @@ function SetCompression($compress) function SetTitle($title, $isUTF8=false) { // Title of document - $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title); + $this->metadata['Title'] = $isUTF8 ? $title : $this->_UTF8encode($title); } function SetAuthor($author, $isUTF8=false) { // Author of document - $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author); + $this->metadata['Author'] = $isUTF8 ? $author : $this->_UTF8encode($author); } function SetSubject($subject, $isUTF8=false) { // Subject of document - $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject); + $this->metadata['Subject'] = $isUTF8 ? $subject : $this->_UTF8encode($subject); } function SetKeywords($keywords, $isUTF8=false) { // Keywords of document - $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords); + $this->metadata['Keywords'] = $isUTF8 ? $keywords : $this->_UTF8encode($keywords); } function SetCreator($creator, $isUTF8=false) { // Creator of document - $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator); + $this->metadata['Creator'] = $isUTF8 ? $creator : $this->_UTF8encode($creator); } function AliasNbPages($alias='{nb}') @@ -409,9 +411,9 @@ function SetTextColor($r, $g=null, $b=null) function GetStringWidth($s) { // Get width of a string in the current font - $s = (string)$s; - $cw = &$this->CurrentFont['cw']; + $cw = $this->CurrentFont['cw']; $w = 0; + $s = (string)$s; $l = strlen($s); for($i=0;$i<$l;$i++) $w += $cw[$s[$i]]; @@ -514,7 +516,7 @@ function SetFont($family, $style='', $size=0) $this->FontStyle = $style; $this->FontSizePt = $size; $this->FontSize = $size/$this->k; - $this->CurrentFont = &$this->fonts[$fontkey]; + $this->CurrentFont = $this->fonts[$fontkey]; if($this->page>0) $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); } @@ -526,7 +528,7 @@ function SetFontSize($size) return; $this->FontSizePt = $size; $this->FontSize = $size/$this->k; - if($this->page>0) + if($this->page>0 && isset($this->CurrentFont)) $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); } @@ -559,8 +561,9 @@ function Text($x, $y, $txt) // Output a string if(!isset($this->CurrentFont)) $this->Error('No font has been set'); + $txt = (string)$txt; $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); - if($this->underline && $txt!='') + if($this->underline && $txt!=='') $s .= ' '.$this->_dounderline($x,$y,$txt); if($this->ColorFlag) $s = 'q '.$this->TextColor.' '.$s.' Q'; @@ -619,6 +622,7 @@ function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link if(strpos($border,'B')!==false) $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); } + $txt = (string)$txt; if($txt!=='') { if(!isset($this->CurrentFont)) @@ -658,11 +662,11 @@ function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) // Output text with automatic or explicit line breaks if(!isset($this->CurrentFont)) $this->Error('No font has been set'); - $cw = &$this->CurrentFont['cw']; + $cw = $this->CurrentFont['cw']; if($w==0) $w = $this->w-$this->rMargin-$this->x; $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; - $s = str_replace("\r",'',$txt); + $s = str_replace("\r",'',(string)$txt); $nb = strlen($s); if($nb>0 && $s[$nb-1]=="\n") $nb--; @@ -773,10 +777,10 @@ function Write($h, $txt, $link='') // Output text in flowing mode if(!isset($this->CurrentFont)) $this->Error('No font has been set'); - $cw = &$this->CurrentFont['cw']; + $cw = $this->CurrentFont['cw']; $w = $this->w-$this->rMargin-$this->x; $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; - $s = str_replace("\r",'',$txt); + $s = str_replace("\r",'',(string)$txt); $nb = strlen($s); $sep = -1; $i = 0; @@ -1010,7 +1014,7 @@ function Output($dest='', $name='', $isUTF8=false) case 'D': // Download file $this->_checkoutput(); - header('Content-Type: application/x-download'); + header('Content-Type: application/pdf'); header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8)); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); @@ -1034,13 +1038,6 @@ function Output($dest='', $name='', $isUTF8=false) * Protected methods * *******************************************************************************/ -protected function _dochecks() -{ - // Check mbstring overloading - if(ini_get('mbstring.func_overload') & 2) - $this->Error('mbstring overloading must be disabled'); -} - protected function _checkoutput() { if(PHP_SAPI!='cli') @@ -1123,9 +1120,9 @@ protected function _beginpage($orientation, $size, $rotation) { if($rotation%90!=0) $this->Error('Incorrect rotation value: '.$rotation); - $this->CurRotation = $rotation; $this->PageInfo[$this->page]['rotation'] = $rotation; } + $this->CurRotation = $rotation; } protected function _endpage() @@ -1166,17 +1163,38 @@ protected function _httpencode($param, $value, $isUTF8) if($this->_isascii($value)) return $param.'="'.$value.'"'; if(!$isUTF8) - $value = utf8_encode($value); - if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false) - return $param.'="'.rawurlencode($value).'"'; - else - return $param."*=UTF-8''".rawurlencode($value); + $value = $this->_UTF8encode($value); + return $param."*=UTF-8''".rawurlencode($value); +} + +protected function _UTF8encode($s) +{ + // Convert ISO-8859-1 to UTF-8 + if($this->iconv) + return iconv('ISO-8859-1','UTF-8',$s); + $res = ''; + $nb = strlen($s); + for($i=0;$i<$nb;$i++) + { + $c = $s[$i]; + $v = ord($c); + if($v>=128) + { + $res .= chr(0xC0 | ($v >> 6)); + $res .= chr(0x80 | ($v & 0x3F)); + } + else + $res .= $c; + } + return $res; } protected function _UTF8toUTF16($s) { // Convert UTF-8 to UTF-16BE with BOM $res = "\xFE\xFF"; + if($this->iconv) + return $res.iconv('UTF-8','UTF-16BE',$s); $nb = strlen($s); $i = 0; while($i<$nb) @@ -1439,19 +1457,20 @@ protected function _parsegif($file) protected function _out($s) { - // Add a line to the document + // Add a line to the current page if($this->state==2) $this->pages[$this->page] .= $s."\n"; - elseif($this->state==1) - $this->_put($s); elseif($this->state==0) $this->Error('No page has been added yet'); + elseif($this->state==1) + $this->Error('Invalid call'); elseif($this->state==3) $this->Error('The document is closed'); } protected function _put($s) { + // Add a line to the document $this->buffer .= $s."\n"; } @@ -1492,6 +1511,29 @@ protected function _putstreamobject($data) $this->_put('endobj'); } +protected function _putlinks($n) +{ + foreach($this->PageLinks[$n] as $pl) + { + $this->_newobj(); + $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $s = '<_textstring($pl[4]).'>>>>'; + else + { + $l = $this->links[$pl[4]]; + if(isset($this->PageInfo[$l[0]]['size'])) + $h = $this->PageInfo[$l[0]]['size'][1]; + else + $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; + $s .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k); + } + $this->_put($s); + $this->_put('endobj'); + } +} + protected function _putpage($n) { $this->_newobj(); @@ -1518,26 +1560,8 @@ protected function _putpage($n) if(!empty($this->AliasNbPages)) $this->pages[$n] = str_replace($this->AliasNbPages,$this->page,$this->pages[$n]); $this->_putstreamobject($this->pages[$n]); - // Annotations - foreach($this->PageLinks[$n] as $pl) - { - $this->_newobj(); - $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); - $s = '<_textstring($pl[4]).'>>>>'; - else - { - $l = $this->links[$pl[4]]; - if(isset($this->PageInfo[$l[0]]['size'])) - $h = $this->PageInfo[$l[0]]['size'][1]; - else - $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; - $s .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k); - } - $this->_put($s); - $this->_put('endobj'); - } + // Link annotations + $this->_putlinks($n); } protected function _putpages() @@ -1668,7 +1692,7 @@ protected function _putfonts() $this->_put('endobj'); // Widths $this->_newobj(); - $cw = &$font['cw']; + $cw = $font['cw']; $s = '['; for($i=32;$i<=255;$i++) $s .= $cw[chr($i)].' '; @@ -1833,8 +1857,8 @@ protected function _putresources() protected function _putinfo() { - $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION; - $this->metadata['CreationDate'] = 'D:'.@date('YmdHis'); + $date = @date('YmdHisO', $this->CreationDate); + $this->metadata['CreationDate'] = 'D:'.substr($date,0,-2)."'".substr($date,-2)."'"; foreach($this->metadata as $key=>$value) $this->_put('/'.$key.' '.$this->_textstring($value)); } @@ -1905,6 +1929,7 @@ protected function _enddoc() $this->_put($offset); $this->_put('%%EOF'); $this->state = 3; + $this->CreationDate = time(); } } ?>