Skip to content

Commit 6a83253

Browse files
committed
Update to 1.83
1 parent b1ce692 commit 6a83253

File tree

5 files changed

+57
-48
lines changed

5 files changed

+57
-48
lines changed

FAQ.htm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@ <h1>FAQ</h1>
4646
<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>
4747
You must send nothing to the browser except the PDF itself: no HTML, no space, no carriage return. A common
4848
case is having extra blank at the end of an included script file.<br>
49-
If you can't figure out where the problem comes from, this other message appearing just before can help you:<br>
49+
If you can't figure out where the problem comes from, this other message appearing just before will help you:<br>
5050
<br>
5151
<b>Warning:</b> Cannot modify header information - headers already sent by (output started at script.php:X)<br>
5252
<br>
53-
It means that script.php outputs something at line X. Go to this line and fix it.
54-
In case the message doesn't show, first check that you didn't disable warnings, then add this at the very
55-
beginning of your script:
53+
It means that script.php outputs something at line X. Go to that line and fix it.
54+
In case the message doesn't show, check if PHP warnings are enabled. If they are not, enable them. If they are,
55+
try adding this at the very beginning of your script:
5656
<div class="doc-source">
5757
<pre><code>ob_end_clean();</code></pre>
5858
</div>
59-
If you still don't see it, disable zlib.output_compression in your php.ini and it should appear.
6059
</li>
6160

6261
<li id='q3'>

changelog.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
<body>
1212
<h1>Changelog</h1>
1313
<dl>
14+
<dt><strong>v1.83</strong> (2021-04-18)</dt>
15+
<dd>
16+
- Fixed an issue related to annotations.<br>
17+
</dd>
1418
<dt><strong>v1.82</strong> (2019-12-07)</dt>
1519
<dd>
1620
- Removed a deprecation notice under PHP 7.4.<br>

doc/index.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<html>
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5-
<title>FPDF 1.82 Reference Manual</title>
5+
<title>FPDF 1.83 Reference Manual</title>
66
<link type="text/css" rel="stylesheet" href="../fpdf.css">
77
</head>
88
<body>
9-
<h1>FPDF 1.82 Reference Manual</h1>
9+
<h1>FPDF 1.83 Reference Manual</h1>
1010
<a href="__construct.htm">__construct</a> - constructor<br>
1111
<a href="acceptpagebreak.htm">AcceptPageBreak</a> - accept or not automatic page break<br>
1212
<a href="addfont.htm">AddFont</a> - add a new font<br>

fpdf.php

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
/*******************************************************************************
33
* FPDF *
44
* *
5-
* Version: 1.82 *
6-
* Date: 2019-12-07 *
5+
* Version: 1.83 *
6+
* Date: 2021-04-18 *
77
* Author: Olivier PLATHEY *
88
*******************************************************************************/
99

10-
define('FPDF_VERSION','1.82');
10+
define('FPDF_VERSION','1.83');
1111

1212
class FPDF
1313
{
@@ -1084,6 +1084,7 @@ protected function _beginpage($orientation, $size, $rotation)
10841084
{
10851085
$this->page++;
10861086
$this->pages[$this->page] = '';
1087+
$this->PageLinks[$this->page] = array();
10871088
$this->state = 2;
10881089
$this->x = $this->lMargin;
10891090
$this->y = $this->tMargin;
@@ -1501,27 +1502,13 @@ protected function _putpage($n)
15011502
if(isset($this->PageInfo[$n]['rotation']))
15021503
$this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
15031504
$this->_put('/Resources 2 0 R');
1504-
if(isset($this->PageLinks[$n]))
1505+
if(!empty($this->PageLinks[$n]))
15051506
{
1506-
// Links
1507-
$annots = '/Annots [';
1507+
$s = '/Annots [';
15081508
foreach($this->PageLinks[$n] as $pl)
1509-
{
1510-
$rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
1511-
$annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1512-
if(is_string($pl[4]))
1513-
$annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
1514-
else
1515-
{
1516-
$l = $this->links[$pl[4]];
1517-
if(isset($this->PageInfo[$l[0]]['size']))
1518-
$h = $this->PageInfo[$l[0]]['size'][1];
1519-
else
1520-
$h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k;
1521-
$annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
1522-
}
1523-
}
1524-
$this->_put($annots.']');
1509+
$s .= $pl[5].' 0 R ';
1510+
$s .= ']';
1511+
$this->_put($s);
15251512
}
15261513
if($this->WithAlpha)
15271514
$this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
@@ -1531,22 +1518,50 @@ protected function _putpage($n)
15311518
if(!empty($this->AliasNbPages))
15321519
$this->pages[$n] = str_replace($this->AliasNbPages,$this->page,$this->pages[$n]);
15331520
$this->_putstreamobject($this->pages[$n]);
1521+
// Annotations
1522+
foreach($this->PageLinks[$n] as $pl)
1523+
{
1524+
$rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
1525+
$s = '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1526+
if(is_string($pl[4]))
1527+
$s .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
1528+
else
1529+
{
1530+
$l = $this->links[$pl[4]];
1531+
if(isset($this->PageInfo[$l[0]]['size']))
1532+
$h = $this->PageInfo[$l[0]]['size'][1];
1533+
else
1534+
$h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k;
1535+
$s .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
1536+
}
1537+
$this->_newobj();
1538+
$this->_put($s);
1539+
$this->_put('endobj');
1540+
}
15341541
}
15351542

15361543
protected function _putpages()
15371544
{
15381545
$nb = $this->page;
1539-
for($n=1;$n<=$nb;$n++)
1540-
$this->PageInfo[$n]['n'] = $this->n+1+2*($n-1);
1541-
for($n=1;$n<=$nb;$n++)
1542-
$this->_putpage($n);
1546+
$n = $this->n;
1547+
for($i=1;$i<=$nb;$i++)
1548+
{
1549+
$this->PageInfo[$i]['n'] = ++$n;
1550+
$n++;
1551+
foreach($this->PageLinks[$i] as &$pl)
1552+
$pl[5] = ++$n;
1553+
unset($pl);
1554+
}
1555+
for($i=1;$i<=$nb;$i++)
1556+
$this->_putpage($i);
15431557
// Pages root
15441558
$this->_newobj(1);
15451559
$this->_put('<</Type /Pages');
15461560
$kids = '/Kids [';
1547-
for($n=1;$n<=$nb;$n++)
1548-
$kids .= $this->PageInfo[$n]['n'].' 0 R ';
1549-
$this->_put($kids.']');
1561+
for($i=1;$i<=$nb;$i++)
1562+
$kids .= $this->PageInfo[$i]['n'].' 0 R ';
1563+
$kids .= ']';
1564+
$this->_put($kids);
15501565
$this->_put('/Count '.$nb);
15511566
if($this->DefOrientation=='P')
15521567
{

makefont/ttfparser.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/*******************************************************************************
33
* Class to parse and subset TrueType fonts *
44
* *
5-
* Version: 1.1 *
6-
* Date: 2015-11-29 *
5+
* Version: 1.11 *
6+
* Date: 2021-04-18 *
77
* Author: Olivier PLATHEY *
88
*******************************************************************************/
99

@@ -75,7 +75,7 @@ function ParseOffsetTable()
7575
$tag = $this->Read(4);
7676
$checkSum = $this->Read(4);
7777
$offset = $this->ReadULong();
78-
$length = $this->ReadULong(4);
78+
$length = $this->ReadULong();
7979
$this->tables[$tag] = array('offset'=>$offset, 'length'=>$length, 'checkSum'=>$checkSum);
8080
}
8181
}
@@ -354,15 +354,7 @@ function ParsePost()
354354

355355
function Subset($chars)
356356
{
357-
/* $chars = array_keys($this->chars);
358-
$this->subsettedChars = $chars;
359357
$this->subsettedGlyphs = array();
360-
for($i=0;$i<$this->numGlyphs;$i++)
361-
{
362-
$this->subsettedGlyphs[] = $i;
363-
$this->glyphs[$i]['ssid'] = $i;
364-
}*/
365-
366358
$this->AddGlyph(0);
367359
$this->subsettedChars = array();
368360
foreach($chars as $char)
@@ -607,7 +599,6 @@ function BuildFont()
607599
$this->tables[$tag]['offset'] = $offset;
608600
$offset += strlen($this->tables[$tag]['data']);
609601
}
610-
// $this->tables['head']['data'] = substr_replace($this->tables['head']['data'], "\x00\x00\x00\x00", 8, 4);
611602

612603
// Build offset table
613604
$entrySelector = 0;

0 commit comments

Comments
 (0)