Skip to content

Commit

Permalink
Update to 1.85
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSlabon committed Nov 18, 2022
1 parent b0ddd9c commit f4104a0
Show file tree
Hide file tree
Showing 15 changed files with 187 additions and 147 deletions.
21 changes: 10 additions & 11 deletions FAQ.htm
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,28 @@ <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 will help you:<br>
<br>
<b>Warning:</b> Cannot modify header information - headers already sent by (output started at script.php:X)<br>
The message may be followed by this indication:<br>
<br>
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)<br>
<br>
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:
<div class="doc-source">
<pre><code>ob_end_clean();</code></pre>
</div>
</li>

<li id='q3'>
<p><b>3.</b> <span class='question'>Accented letters are replaced with some strange characters like é.</span></p>
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:
<div class="doc-source">
<pre><code>$str = utf8_decode($str);</code></pre>
<pre><code>$str = iconv('UTF-8', 'windows-1252', $str);</code></pre>
</div>
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:
<div class="doc-source">
<pre><code>$str = iconv('UTF-8', 'windows-1252', $str);</code></pre>
<pre><code>$str = mb_convert_encoding($str, 'windows-1252', 'UTF-8');</code></pre>
</div>
In case you need characters outside windows-1252, take a look at tutorial #7 or
<a href="http://www.fpdf.org/?go=script&amp;id=92" target="_blank">tFPDF</a>.
Expand Down
12 changes: 10 additions & 2 deletions changelog.htm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
<body>
<h1>Changelog</h1>
<dl>
<dt><strong>v1.85</strong> (2022-11-10)</dt>
<dd>
- Removed deprecation notices on PHP 8.2.<br>
- Removed notices when passing null values instead of strings.<br>
- The FPDF_VERSION constant was replaced by a class constant.<br>
- The creation date of the PDF now includes the timezone.<br>
- The content-type is now always application/pdf, even for downloads.<br>
</dd>
<dt><strong>v1.84</strong> (2021-08-28)</dt>
<dd>
- Fixed an issue related to annotations.<br>
Expand All @@ -21,7 +29,7 @@ <h1>Changelog</h1>
</dd>
<dt><strong>v1.82</strong> (2019-12-07)</dt>
<dd>
- Removed a deprecation notice under PHP 7.4.<br>
- Removed a deprecation notice on PHP 7.4.<br>
</dd>
<dt><strong>v1.81</strong> (2015-12-20)</dt>
<dd>
Expand Down Expand Up @@ -94,7 +102,7 @@ <h1>Changelog</h1>
<dd>
- Type1 font support.<br>
- Added Baltic encoding.<br>
- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5:<br>&nbsp;&nbsp;* The line thickness was too large when printed under Windows 98 SE and ME.<br>&nbsp;&nbsp;* 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.<br>
- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5:<br>&nbsp;&nbsp;* The line thickness was too large when printed on Windows 98 SE and ME.<br>&nbsp;&nbsp;* 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.<br>
- It's no longer necessary to set the decimal separator as dot to produce valid documents.<br>
- The clickable area in a cell was always on the left independently from the text alignment.<br>
- JPEG images in CMYK mode appeared in inverted colors.<br>
Expand Down
4 changes: 2 additions & 2 deletions doc/__construct.htm
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ <h2>Parameters</h2>
</dd>
</dl>
<h2>Example</h2>
Example with a custom 100x150 mm page size:
Document with a custom 100x150 mm page size:
<div class="doc-source">
<pre><code>$pdf = new FPDF('P','mm',array(100,150));</code></pre>
<pre><code>$pdf = new FPDF('P', 'mm', array(100,150));</code></pre>
</div>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
Expand Down
48 changes: 24 additions & 24 deletions doc/acceptpagebreak.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,40 @@ <h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
var $col = 0;
protected $col = 0;

function SetCol($col)
{
// Move position to a column
$this-&gt;col = $col;
$x = 10+$col*65;
$this-&gt;SetLeftMargin($x);
$this-&gt;SetX($x);
}

function AcceptPageBreak()
{
if($this-&gt;col&lt;2)
function SetCol($col)
{
// Go to next column
$this-&gt;SetCol($this-&gt;col+1);
$this-&gt;SetY(10);
return false;
// Move position to a column
$this-&gt;col = $col;
$x = 10 + $col*65;
$this-&gt;SetLeftMargin($x);
$this-&gt;SetX($x);
}
else

function AcceptPageBreak()
{
// Go back to first column and issue page break
$this-&gt;SetCol(0);
return true;
if($this-&gt;col&lt;2)
{
// Go to next column
$this-&gt;SetCol($this-&gt;col+1);
$this-&gt;SetY(10);
return false;
}
else
{
// Go back to first column and issue page break
$this-&gt;SetCol(0);
return true;
}
}
}
}

$pdf = new PDF();
$pdf-&gt;AddPage();
$pdf-&gt;SetFont('Arial','',12);
$pdf-&gt;SetFont('Arial', '', 12);
for($i=1;$i&lt;=300;$i++)
$pdf-&gt;Cell(0,5,"Line $i",0,1);
$pdf-&gt;Cell(0, 5, "Line $i", 0, 1);
$pdf-&gt;Output();</code></pre>
</div>
<h2>See also</h2>
Expand Down
4 changes: 2 additions & 2 deletions doc/addfont.htm
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ <h2>Parameters</h2>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>$pdf-&gt;AddFont('Comic','I');</code></pre>
<pre><code>$pdf-&gt;AddFont('Comic', 'I');</code></pre>
</div>
is equivalent to:
<div class="doc-source">
<pre><code>$pdf-&gt;AddFont('Comic','I','comici.php');</code></pre>
<pre><code>$pdf-&gt;AddFont('Comic', 'I', 'comici.php');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>
Expand Down
18 changes: 9 additions & 9 deletions doc/aliasnbpages.htm
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ <h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial','I',8);
// Print current and total page numbers
$this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo().'/{nb}',0,0,'C');
}
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial', 'I', 8);
// Print current and total page numbers
$this-&gt;Cell(0, 10, 'Page '.$this-&gt;PageNo().'/{nb}', 0, 0, 'C');
}
}

$pdf = new PDF();
Expand Down
4 changes: 2 additions & 2 deletions doc/cell.htm
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ <h2>Parameters</h2>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Set font
$pdf-&gt;SetFont('Arial','B',16);
$pdf-&gt;SetFont('Arial', 'B', 16);
// Move to 8 cm to the right
$pdf-&gt;Cell(80);
// Centered text in a framed 20*10 mm cell and line break
$pdf-&gt;Cell(20,10,'Title',1,1,'C');</code></pre>
$pdf-&gt;Cell(20, 10, 'Title', 1, 1, 'C');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
Expand Down
18 changes: 9 additions & 9 deletions doc/footer.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ <h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial','I',8);
// Print centered page number
$this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo(),0,0,'C');
}
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial', 'I', 8);
// Print centered page number
$this-&gt;Cell(0, 10, 'Page '.$this-&gt;PageNo(), 0, 0, 'C');
}
}</code></pre>
</div>
<h2>See also</h2>
Expand Down
22 changes: 11 additions & 11 deletions doc/header.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ <h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Header()
{
// Select Arial bold 15
$this-&gt;SetFont('Arial','B',15);
// Move to the right
$this-&gt;Cell(80);
// Framed title
$this-&gt;Cell(30,10,'Title',1,0,'C');
// Line break
$this-&gt;Ln(20);
}
function Header()
{
// Select Arial bold 15
$this-&gt;SetFont('Arial', 'B', 15);
// Move to the right
$this-&gt;Cell(80);
// Framed title
$this-&gt;Cell(30, 10, 'Title', 1, 0, 'C');
// Line break
$this-&gt;Ln(20);
}
}</code></pre>
</div>
<h2>See also</h2>
Expand Down
4 changes: 2 additions & 2 deletions doc/image.htm
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ <h2>Parameters</h2>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Insert a logo in the top-left corner at 300 dpi
$pdf-&gt;Image('logo.png',10,10,-300);
$pdf-&gt;Image('logo.png', 10, 10, -300);
// Insert a dynamic image from a URL
$pdf-&gt;Image('http://chart.googleapis.com/chart?cht=p3&amp;chd=t:60,40&amp;chs=250x100&amp;chl=Hello|World',60,30,90,0,'PNG');</code></pre>
$pdf-&gt;Image('http://chart.googleapis.com/chart?cht=p3&amp;chd=t:60,40&amp;chs=250x100&amp;chl=Hello|World', 60, 30, 90, 0, 'PNG');</code></pre>
</div>
<h2>See also</h2>
<a href="addlink.htm">AddLink</a>
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.84 Reference Manual</title>
<title>FPDF 1.85 Reference Manual</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>FPDF 1.84 Reference Manual</h1>
<h1>FPDF 1.85 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
9 changes: 9 additions & 0 deletions doc/output.htm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ <h2>Parameters</h2>
The default value is <code>false</code>.
</dd>
</dl>
<h2>Example</h2>
Save the document to a local directory:
<div class="doc-source">
<pre><code>$pdf-&gt;Output('F', 'reports/report.pdf');</code></pre>
</div>
Force a download:
<div class="doc-source">
<pre><code>$pdf-&gt;Output('D', 'report.pdf');</code></pre>
</div>
<h2>See also</h2>
<a href="close.htm">Close</a>
<hr style="margin-top:1.5em">
Expand Down
11 changes: 5 additions & 6 deletions doc/setfont.htm
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ <h2>Description</h2>
<br>
<strong>Note:</strong> the font definition files must be accessible. They are searched successively in:
<ul>
<li>The directory defined by the <code>FPDF_FONTPATH</code> constant (if this constant is defined)</li>
<li>The directory defined by the <code>FPDF_FONTPATH</code> constant (if that constant is defined)</li>
<li>The <code>font</code> directory located in the same directory as <code>fpdf.php</code> (if it exists)</li>
<li>The directories accessible through <code>include()</code></li>
</ul>
Example using <code>FPDF_FONTPATH</code>:
<div class="doc-source">
<pre><code>define('FPDF_FONTPATH','/home/www/font');
<pre><code>define('FPDF_FONTPATH', '/home/www/font');
require('fpdf.php');</code></pre>
</div>
If the file corresponding to the requested font is not found, the error "Could not include font
Expand Down Expand Up @@ -66,19 +65,19 @@ <h2>Parameters</h2>
Font size in points.
<br>
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.
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Times regular 12
$pdf-&gt;SetFont('Times');
// Arial bold 14
$pdf-&gt;SetFont('Arial','B',14);
$pdf-&gt;SetFont('Arial', 'B', 14);
// Removes bold
$pdf-&gt;SetFont('');
// Times bold, italic and underlined 14
$pdf-&gt;SetFont('Times','BIU');</code></pre>
$pdf-&gt;SetFont('Times', 'BIU');</code></pre>
</div>
<h2>See also</h2>
<a href="addfont.htm">AddFont</a>,
Expand Down
10 changes: 5 additions & 5 deletions doc/write.htm
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ <h2>Parameters</h2>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Begin with regular font
$pdf-&gt;SetFont('Arial','',14);
$pdf-&gt;Write(5,'Visit ');
$pdf-&gt;SetFont('Arial', '', 14);
$pdf-&gt;Write(5, 'Visit ');
// Then put a blue underlined link
$pdf-&gt;SetTextColor(0,0,255);
$pdf-&gt;SetFont('','U');
$pdf-&gt;Write(5,'www.fpdf.org','http://www.fpdf.org');</code></pre>
$pdf-&gt;SetTextColor(0, 0, 255);
$pdf-&gt;SetFont('', 'U');
$pdf-&gt;Write(5, 'www.fpdf.org', 'http://www.fpdf.org');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
Expand Down

0 comments on commit f4104a0

Please sign in to comment.