Skip to content

Commit

Permalink
Update to 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSlabon committed Apr 20, 2021
1 parent b1ce692 commit 6a83253
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 48 deletions.
9 changes: 4 additions & 5 deletions FAQ.htm
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,16 @@ <h1>FAQ</h1>
<p><b>2.</b> <span class='question'>I get the following error when I try to generate a PDF: Some data has already been output, can't send PDF file</span></p>
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.<br>
If you can't figure out where the problem comes from, this other message appearing just before can help you:<br>
If you can't figure out where the problem comes from, this other message appearing just before will help you:<br>
<br>
<b>Warning:</b> Cannot modify header information - headers already sent by (output started at script.php:X)<br>
<br>
It means that script.php outputs something at line X. Go to this line and fix it.
In case the message doesn't show, first check that you didn't disable warnings, then add this at the very
beginning of your script:
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:
<div class="doc-source">
<pre><code>ob_end_clean();</code></pre>
</div>
If you still don't see it, disable zlib.output_compression in your php.ini and it should appear.
</li>

<li id='q3'>
Expand Down
4 changes: 4 additions & 0 deletions changelog.htm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<body>
<h1>Changelog</h1>
<dl>
<dt><strong>v1.83</strong> (2021-04-18)</dt>
<dd>
- Fixed an issue related to annotations.<br>
</dd>
<dt><strong>v1.82</strong> (2019-12-07)</dt>
<dd>
- Removed a deprecation notice under PHP 7.4.<br>
Expand Down
4 changes: 2 additions & 2 deletions doc/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>FPDF 1.82 Reference Manual</title>
<title>FPDF 1.83 Reference Manual</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>FPDF 1.82 Reference Manual</h1>
<h1>FPDF 1.83 Reference Manual</h1>
<a href="__construct.htm">__construct</a> - constructor<br>
<a href="acceptpagebreak.htm">AcceptPageBreak</a> - accept or not automatic page break<br>
<a href="addfont.htm">AddFont</a> - add a new font<br>
Expand Down
73 changes: 44 additions & 29 deletions fpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/*******************************************************************************
* FPDF *
* *
* Version: 1.82 *
* Date: 2019-12-07 *
* Version: 1.83 *
* Date: 2021-04-18 *
* Author: Olivier PLATHEY *
*******************************************************************************/

define('FPDF_VERSION','1.82');
define('FPDF_VERSION','1.83');

class FPDF
{
Expand Down Expand Up @@ -1084,6 +1084,7 @@ protected function _beginpage($orientation, $size, $rotation)
{
$this->page++;
$this->pages[$this->page] = '';
$this->PageLinks[$this->page] = array();
$this->state = 2;
$this->x = $this->lMargin;
$this->y = $this->tMargin;
Expand Down Expand Up @@ -1501,27 +1502,13 @@ protected function _putpage($n)
if(isset($this->PageInfo[$n]['rotation']))
$this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
$this->_put('/Resources 2 0 R');
if(isset($this->PageLinks[$n]))
if(!empty($this->PageLinks[$n]))
{
// Links
$annots = '/Annots [';
$s = '/Annots [';
foreach($this->PageLinks[$n] as $pl)
{
$rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
$annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
if(is_string($pl[4]))
$annots .= '/A <</S /URI /URI '.$this->_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;
$annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
}
}
$this->_put($annots.']');
$s .= $pl[5].' 0 R ';
$s .= ']';
$this->_put($s);
}
if($this->WithAlpha)
$this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
Expand All @@ -1531,22 +1518,50 @@ 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)
{
$rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
$s = '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
if(is_string($pl[4]))
$s .= '/A <</S /URI /URI '.$this->_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->_newobj();
$this->_put($s);
$this->_put('endobj');
}
}

protected function _putpages()
{
$nb = $this->page;
for($n=1;$n<=$nb;$n++)
$this->PageInfo[$n]['n'] = $this->n+1+2*($n-1);
for($n=1;$n<=$nb;$n++)
$this->_putpage($n);
$n = $this->n;
for($i=1;$i<=$nb;$i++)
{
$this->PageInfo[$i]['n'] = ++$n;
$n++;
foreach($this->PageLinks[$i] as &$pl)
$pl[5] = ++$n;
unset($pl);
}
for($i=1;$i<=$nb;$i++)
$this->_putpage($i);
// Pages root
$this->_newobj(1);
$this->_put('<</Type /Pages');
$kids = '/Kids [';
for($n=1;$n<=$nb;$n++)
$kids .= $this->PageInfo[$n]['n'].' 0 R ';
$this->_put($kids.']');
for($i=1;$i<=$nb;$i++)
$kids .= $this->PageInfo[$i]['n'].' 0 R ';
$kids .= ']';
$this->_put($kids);
$this->_put('/Count '.$nb);
if($this->DefOrientation=='P')
{
Expand Down
15 changes: 3 additions & 12 deletions makefont/ttfparser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/*******************************************************************************
* Class to parse and subset TrueType fonts *
* *
* Version: 1.1 *
* Date: 2015-11-29 *
* Version: 1.11 *
* Date: 2021-04-18 *
* Author: Olivier PLATHEY *
*******************************************************************************/

Expand Down Expand Up @@ -75,7 +75,7 @@ function ParseOffsetTable()
$tag = $this->Read(4);
$checkSum = $this->Read(4);
$offset = $this->ReadULong();
$length = $this->ReadULong(4);
$length = $this->ReadULong();
$this->tables[$tag] = array('offset'=>$offset, 'length'=>$length, 'checkSum'=>$checkSum);
}
}
Expand Down Expand Up @@ -354,15 +354,7 @@ function ParsePost()

function Subset($chars)
{
/* $chars = array_keys($this->chars);
$this->subsettedChars = $chars;
$this->subsettedGlyphs = array();
for($i=0;$i<$this->numGlyphs;$i++)
{
$this->subsettedGlyphs[] = $i;
$this->glyphs[$i]['ssid'] = $i;
}*/

$this->AddGlyph(0);
$this->subsettedChars = array();
foreach($chars as $char)
Expand Down Expand Up @@ -607,7 +599,6 @@ function BuildFont()
$this->tables[$tag]['offset'] = $offset;
$offset += strlen($this->tables[$tag]['data']);
}
// $this->tables['head']['data'] = substr_replace($this->tables['head']['data'], "\x00\x00\x00\x00", 8, 4);

// Build offset table
$entrySelector = 0;
Expand Down

0 comments on commit 6a83253

Please sign in to comment.