diff options
116 files changed, 1581 insertions, 954 deletions
diff --git a/pdf/cert_new.inc b/pdf/cert_new.inc index 43346de..ed37dee 100755 --- a/pdf/cert_new.inc +++ b/pdf/cert_new.inc @@ -42,7 +42,7 @@ function generate_pdf() } //!$pdf $pdf->AddPage(); $image_bg = $mpath . "/pdf/images/bg_cert.png"; - $pdf->Image($image_bg, 0, 0, $pdf->w, $pdf->h); + $pdf->Image($image_bg, 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight()); $pdf->SetMargins(18, 1, 18); $path = drupal_get_path('module', 'om_pssp'); $pdf->Ln(50); @@ -53,18 +53,18 @@ function generate_pdf() $pdf->SetFont('Times', 'I', 16); $pdf->SetTextColor(37, 22, 247); $contributor_name = WordWrap($data3->contributor_name,70); - $pdf->MultiCell(240, 8, $data3->name_title . '. ' . $contributor_name, '0', 'C'); + $pdf->MultiCell(240, 8, $data3->name_title . '. ' . utf8_decode($contributor_name), '0', 'C'); $pdf->Ln(0); $pdf->SetFont('Times', '', 14); $title = WordWrap($data3->project_title,160); $university = WordWrap('from ' . $data3->university . ' has successfully contributed under the ', 160); $pdf->SetTextColor(0, 0, 0); - $pdf->MultiCell(240, 8, $university . 'OpenModelica Power Systems Simulation Project.', '0','C'); + $pdf->MultiCell(240, 8, utf8_decode($university) . 'OpenModelica Power Systems Simulation Project.', '0','C'); $pdf->Ln(0); $pdf->Cell(240, 8, 'He/She has created the following simulation', '0', '1', 'C'); $pdf->SetTextColor(37, 22, 247); $pdf->SetFont('Times','I',16); - $pdf->MultiCell(240, 8, $title, '0', 'C'); + $pdf->MultiCell(240, 8, utf8_decode($title), '0', 'C'); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('Times','',14); $pdf->Cell(240, 8, 'using OpenModelica. The code is available at ', '0', '', 'C'); @@ -125,18 +125,26 @@ function generate_pdf() $filename = str_replace(' ', '-', $data3->contributor_name) . '-OpenModelica-PSSP-Certificate.pdf'; $file = $path . '/pdf/temp_certificate/' . $proposal_id . '_' . $filename; $pdf->Output($file, 'F'); - header("Content-Type: application/octet-stream"); - header("Content-Disposition: attachment; filename=" . $filename); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); + ob_clean(); + header("Pragma: public"); + header("Expires: 0"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Cache-Control: public"); header("Content-Description: File Transfer"); + header("Content-Type: application/pdf"); + header("Content-Disposition: attachment; filename=" . $filename); header("Content-Length: " . filesize($file)); + header("Content-Transfer-Encoding: binary"); + header("Expires: 0"); + header("Pragma: no-cache"); flush(); $fp = fopen($file, "r"); while (!feof($fp)) { - echo fread($fp, 65536); + echo fread($fp, filesize($file)); flush(); } //!feof($fp) + ob_end_flush(); + ob_clean(); fclose($fp); unlink($file); //drupal_goto('flowsheeting-project/certificate'); diff --git a/pdf/fpdf/FAQ.htm b/pdf/fpdf/FAQ.htm index 05d85c6..f41ad8a 100755..100644 --- a/pdf/fpdf/FAQ.htm +++ b/pdf/fpdf/FAQ.htm @@ -14,19 +14,19 @@ ul#answers li {margin-top:1.8em} <h1>FAQ</h1>
<ul>
<li><b>1.</b> <a href='#q1'>What's exactly the license of FPDF? Are there any usage restrictions?</a></li>
-<li><b>2.</b> <a href='#q2'>When I try to create a PDF, a lot of weird characters show on the screen. Why?</a></li>
-<li><b>3.</b> <a href='#q3'>I try to generate a PDF and IE displays a blank page. What happens?</a></li>
-<li><b>4.</b> <a href='#q4'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</a></li>
+<li><b>2.</b> <a href='#q2'>I get the following error when I try to generate a PDF: Some data has already been output, can't send PDF file</a></li>
+<li><b>3.</b> <a href='#q3'>Accented letters are replaced with some strange characters like é.</a></li>
+<li><b>4.</b> <a href='#q4'>I try to display the Euro symbol but it doesn't work.</a></li>
<li><b>5.</b> <a href='#q5'>I try to display a variable in the Header method but nothing prints.</a></li>
-<li><b>6.</b> <a href='#q6'>I defined the Header and Footer methods in my PDF class but nothing appears.</a></li>
-<li><b>7.</b> <a href='#q7'>Accented characters are replaced by some strange characters like é.</a></li>
-<li><b>8.</b> <a href='#q8'>I try to display the Euro symbol but it doesn't work.</a></li>
-<li><b>9.</b> <a href='#q9'>I get the following error when I try to generate a PDF: Some data has already been output, can't send PDF file</a></li>
-<li><b>10.</b> <a href='#q10'>I draw a frame with very precise dimensions, but when printed I notice some differences.</a></li>
-<li><b>11.</b> <a href='#q11'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</a></li>
-<li><b>12.</b> <a href='#q12'>How can I put a background in my PDF?</a></li>
-<li><b>13.</b> <a href='#q13'>How can I set a specific header or footer on the first page?</a></li>
-<li><b>14.</b> <a href='#q14'>I'd like to use extensions provided by different scripts. How can I combine them?</a></li>
+<li><b>6.</b> <a href='#q6'>I have defined the Header and Footer methods in my PDF class but nothing shows.</a></li>
+<li><b>7.</b> <a href='#q7'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</a></li>
+<li><b>8.</b> <a href='#q8'>I use jQuery to generate the PDF but it doesn't show.</a></li>
+<li><b>9.</b> <a href='#q9'>I draw a frame with very precise dimensions, but when printed I notice some differences.</a></li>
+<li><b>10.</b> <a href='#q10'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</a></li>
+<li><b>11.</b> <a href='#q11'>How can I put a background in my PDF?</a></li>
+<li><b>12.</b> <a href='#q12'>How can I set a specific header or footer on the first page?</a></li>
+<li><b>13.</b> <a href='#q13'>I'd like to use extensions provided by different scripts. How can I combine them?</a></li>
+<li><b>14.</b> <a href='#q14'>How can I open the PDF in a new tab?</a></li>
<li><b>15.</b> <a href='#q15'>How can I send the PDF by email?</a></li>
<li><b>16.</b> <a href='#q16'>What's the limit of the file sizes I can generate with FPDF?</a></li>
<li><b>17.</b> <a href='#q17'>Can I modify a PDF with FPDF?</a></li>
@@ -43,77 +43,45 @@ freely in your application (commercial or not), with or without modifications. </li>
<li id='q2'>
-<p><b>2.</b> <span class='question'>When I try to create a PDF, a lot of weird characters show on the screen. Why?</span></p>
-These "weird" characters are in fact the actual content of your PDF. This behavior is a bug of
-IE6. When it first receives an HTML page, then a PDF from the same URL, it displays it directly
-without launching Acrobat. This happens frequently during the development stage: on the least
-script error, an HTML page is sent, and after correction, the PDF arrives.
+<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>
<br>
-To solve the problem, simply quit and restart IE. You can also go to another URL and come
-back.
+<b>Warning:</b> Cannot modify header information - headers already sent by (output started at script.php:X)<br>
<br>
-To avoid this kind of inconvenience during the development, you can generate the PDF directly
-to a file and open it through the explorer.
+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:
+<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'>
-<p><b>3.</b> <span class='question'>I try to generate a PDF and IE displays a blank page. What happens?</span></p>
-First of all, check that you send nothing to the browser after the PDF (not even a space or a
-carriage return). You can put an exit statement just after the call to the Output() method to
-be sure. If it still doesn't work, it means you're a victim of the "blank page syndrome". IE
-used in conjunction with the Acrobat plug-in suffers from many bugs. To avoid these problems
-in a reliable manner, two main techniques exist:
-<br>
-<br>
-- Disable the plug-in and use Acrobat as a helper application. To do this, launch Acrobat, go
-to the Edit menu, Preferences, Internet, and uncheck "Display PDF in browser". Then, the next
-time you load a PDF in IE, it displays the dialog box "Open it" or "Save it to disk". Uncheck
-the option "Always ask before opening this type of file" and choose Open. From now on, PDF files
-will open automatically in an external Acrobat window.
-<br>
-The drawback of the method is that you need to alter the client configuration, which you can do
-in an intranet environment but not for the Internet.
-<br>
-<br>
-- Use a redirection technique. It consists in generating the PDF in a temporary file on the server
-and redirect the client to it. For example, at the end of the script, you can put the following:
+<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:
<div class="doc-source">
-<pre><code>//Determine a temporary file name in the current directory
-$file = basename(tempnam('.', 'tmp'));
-rename($file, $file.'.pdf');
-$file .= '.pdf';
-//Save PDF to file
-$pdf->Output($file, 'F');
-//Redirect
-header('Location: '.$file);</code></pre>
+<pre><code>$str = utf8_decode($str);</code></pre>
</div>
-This method turns the dynamic PDF into a static one and avoids all troubles. But you have to do
-some cleaning in order to delete the temporary files. For example:
+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:
<div class="doc-source">
-<pre><code>function CleanFiles($dir)
-{
- //Delete temporary files
- $t = time();
- $h = opendir($dir);
- while($file=readdir($h))
- {
- if(substr($file,0,3)=='tmp' && substr($file,-4)=='.pdf')
- {
- $path = $dir.'/'.$file;
- if($t-filemtime($path)>3600)
- @unlink($path);
- }
- }
- closedir($h);
-}</code></pre>
+<pre><code>$str = iconv('UTF-8', 'windows-1252', $str);</code></pre>
</div>
-This function deletes all files of the form tmp*.pdf older than an hour in the specified
-directory. You may call it where you want, for example in the script which generates the PDF.
+In case you need characters outside windows-1252, take a look at tutorial #7 or
+<a href="http://www.fpdf.org/?go=script&id=92" target="_blank">tFPDF</a>.
</li>
<li id='q4'>
-<p><b>4.</b> <span class='question'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</span></p>
-You have to enclose your string with double quotes, not single ones.
+<p><b>4.</b> <span class='question'>I try to display the Euro symbol but it doesn't work.</span></p>
+The standard fonts have the Euro character at position 128. You can define a constant like this
+for convenience:
+<div class="doc-source">
+<pre><code>define('EURO', chr(128));</code></pre>
+</div>
</li>
<li id='q5'>
@@ -143,7 +111,7 @@ $pdf->title = 'My title';</code></pre> </li>
<li id='q6'>
-<p><b>6.</b> <span class='question'>I defined the Header and Footer methods in my PDF class but nothing appears.</span></p>
+<p><b>6.</b> <span class='question'>I have defined the Header and Footer methods in my PDF class but nothing shows.</span></p>
You have to create an object from the PDF class, not FPDF:
<div class="doc-source">
<pre><code>$pdf = new PDF();</code></pre>
@@ -151,64 +119,34 @@ You have to create an object from the PDF class, not FPDF: </li>
<li id='q7'>
-<p><b>7.</b> <span class='question'>Accented characters are replaced by some strange characters like é.</span></p>
-Don't use UTF-8 encoding. Standard FPDF fonts use ISO-8859-1 or Windows-1252.
-It is possible to perform a conversion to ISO-8859-1 with utf8_decode():
-<div class="doc-source">
-<pre><code>$str = utf8_decode($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:
-<div class="doc-source">
-<pre><code>$str = iconv('UTF-8', 'windows-1252', $str);</code></pre>
-</div>
+<p><b>7.</b> <span class='question'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</span></p>
+You have to enclose your string with double quotes, not single ones.
</li>
<li id='q8'>
-<p><b>8.</b> <span class='question'>I try to display the Euro symbol but it doesn't work.</span></p>
-The standard fonts have the Euro character at position 128. You can define a constant like this
-for convenience:
-<div class="doc-source">
-<pre><code>define('EURO', chr(128));</code></pre>
-</div>
+<p><b>8.</b> <span class='question'>I use jQuery to generate the PDF but it doesn't show.</span></p>
+Don't use an AJAX request to retrieve the PDF.
</li>
<li id='q9'>
-<p><b>9.</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>
-<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:
-<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='q10'>
-<p><b>10.</b> <span class='question'>I draw a frame with very precise dimensions, but when printed I notice some differences.</span></p>
+<p><b>9.</b> <span class='question'>I draw a frame with very precise dimensions, but when printed I notice some differences.</span></p>
To respect dimensions, select "None" for the Page Scaling setting instead of "Shrink to Printable Area" in the print dialog box.
</li>
-<li id='q11'>
-<p><b>11.</b> <span class='question'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</span></p>
+<li id='q10'>
+<p><b>10.</b> <span class='question'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</span></p>
Printers have physical margins (different depending on the models); it is therefore impossible to remove
them and print on the whole surface of the paper.
</li>
-<li id='q12'>
-<p><b>12.</b> <span class='question'>How can I put a background in my PDF?</span></p>
+<li id='q11'>
+<p><b>11.</b> <span class='question'>How can I put a background in my PDF?</span></p>
For a picture, call Image() in the Header() method, before any other output. To set a background color, use Rect().
</li>
-<li id='q13'>
-<p><b>13.</b> <span class='question'>How can I set a specific header or footer on the first page?</span></p>
-Simply test the page number:
+<li id='q12'>
+<p><b>12.</b> <span class='question'>How can I set a specific header or footer on the first page?</span></p>
+Just test the page number:
<div class="doc-source">
<pre><code>function Header()
{
@@ -226,8 +164,8 @@ Simply test the page number: </div>
</li>
-<li id='q14'>
-<p><b>14.</b> <span class='question'>I'd like to use extensions provided by different scripts. How can I combine them?</span></p>
+<li id='q13'>
+<p><b>13.</b> <span class='question'>I'd like to use extensions provided by different scripts. How can I combine them?</span></p>
Use an inheritance chain. If you have two classes, say A in a.php:
<div class="doc-source">
<pre><code>require('fpdf.php');
@@ -268,14 +206,19 @@ $pdf = new PDF();</code></pre> </div>
</li>
+<li id='q14'>
+<p><b>14.</b> <span class='question'>How can I open the PDF in a new tab?</span></p>
+Just do the same as you would for an HTML page or anything else: add a target="_blank" to your link or form.
+</li>
+
<li id='q15'>
<p><b>15.</b> <span class='question'>How can I send the PDF by email?</span></p>
-As any other file, but an easy way is to use <a href="http://phpmailer.codeworxtech.com">PHPMailer</a> and
+As for any other file, but an easy way is to use <a href="https://github.com/PHPMailer/PHPMailer" target="_blank">PHPMailer</a> and
its in-memory attachment:
<div class="doc-source">
<pre><code>$mail = new PHPMailer();
...
-$doc = $pdf->Output('', 'S');
+$doc = $pdf->Output('S');
$mail->AddStringAttachment($doc, 'doc.pdf', 'base64', 'application/pdf');
$mail->Send();</code></pre>
</div>
@@ -286,55 +229,43 @@ $mail->Send();</code></pre> There is no particular limit. There are some constraints, however:
<br>
<br>
-- The maximum memory size allocated to PHP scripts is usually 8MB. For very big documents,
-especially with images, this limit may be reached (the file being built into memory). The
+- There is usually a maximum memory size allocated to PHP scripts. For very big documents,
+especially with images, the limit may be reached (the file being built in memory). The
parameter is configured in the php.ini file.
<br>
<br>
-- The maximum execution time allocated defaults to 30 seconds. This limit can of course be easily
-reached. It is configured in php.ini and may be altered dynamically with set_time_limit().
+- The maximum execution time allocated to scripts defaults to 30 seconds. This limit can of course
+be easily reached. It is configured in php.ini and may be altered dynamically with set_time_limit().
<br>
<br>
-- Browsers generally have a 5 minute time-out. If you send the PDF directly to the browser and
-reach the limit, it will be lost. It is therefore advised for very big documents to
-generate them in a file, and to send some data to the browser from time to time (with a call
-to flush() to force the output). When the document is finished, you can send a redirection to
-it or create a link.
-<br>
-Remark: even if the browser times out, the script may continue to run on the server.
+You can work around the memory limit with <a href="http://www.fpdf.org/?go=script&id=76" target="_blank">this script</a>.
</li>
<li id='q17'>
<p><b>17.</b> <span class='question'>Can I modify a PDF with FPDF?</span></p>
-It is possible to import pages from an existing PDF document thanks to the FPDI extension:<br>
-<br>
-<a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/" target="_blank">http://www.setasign.de/products/pdf-php-solutions/fpdi/</a><br>
-<br>
-You can then add some content to them.
+It's possible to import pages from an existing PDF document thanks to the
+<a href="https://www.setasign.com/products/fpdi/about/" target="_blank">FPDI</a> extension.
+Then you can add some content to them.
</li>
<li id='q18'>
<p><b>18.</b> <span class='question'>I'd like to make a search engine in PHP and index PDF files. Can I do it with FPDF?</span></p>
-No. But a GPL C utility does exist, pdftotext, which is able to extract the textual content from
-a PDF. It is provided with the Xpdf package:<br>
-<br>
-<a href="http://www.foolabs.com/xpdf/" target="_blank">http://www.foolabs.com/xpdf/</a>
+No. But a GPL C utility does exist, pdftotext, which is able to extract the textual content from a PDF.
+It's provided with the <a href="https://www.xpdfreader.com" target="_blank">Xpdf</a> package.
</li>
<li id='q19'>
<p><b>19.</b> <span class='question'>Can I convert an HTML page to PDF with FPDF?</span></p>
-Not real-world pages. But a GPL C utility does exist, htmldoc, which allows to do it and gives good results:<br>
-<br>
-<a href="http://www.htmldoc.org" target="_blank">http://www.htmldoc.org</a>
+Not real-world pages. But a GPL C utility does exist, <a href="https://www.msweet.org/htmldoc/" target="_blank">HTMLDOC</a>,
+which allows to do it and gives good results.
</li>
<li id='q20'>
<p><b>20.</b> <span class='question'>Can I concatenate PDF files with FPDF?</span></p>
-Not directly, but it is possible to use <a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/demos/concatenate-fake/" target="_blank">FPDI</a>
-to perform this task. Some free command-line tools also exist:<br>
-<br>
-<a href="http://thierry.schmit.free.fr/spip/spip.php?article15&lang=en" target="_blank">mbtPdfAsm</a><br>
-<a href="http://www.accesspdf.com/pdftk/" target="_blank">pdftk</a>
+Not directly, but it's possible to use <a href="https://www.setasign.com/products/fpdi/demos/concatenate-fake/" target="_blank">FPDI</a>
+to perform that task. Some free command-line tools also exist:
+<a href="https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/" target="_blank">pdftk</a> and
+<a href="http://thierry.schmit.free.fr/spip/spip.php?article15" target="_blank">mbtPdfAsm</a>.
</li>
</ul>
</body>
diff --git a/pdf/fpdf/changelog.htm b/pdf/fpdf/changelog.htm index 2549c38..11362d2 100755..100644 --- a/pdf/fpdf/changelog.htm +++ b/pdf/fpdf/changelog.htm @@ -11,6 +11,27 @@ dd {margin:1em 0 1em 1em} <body>
<h1>Changelog</h1>
<dl>
+<dt><strong>v1.82</strong> (2019-12-07)</dt>
+<dd>
+- Removed a deprecation notice under PHP 7.4.<br>
+</dd>
+<dt><strong>v1.81</strong> (2015-12-20)</dt>
+<dd>
+- Added GetPageWidth() and GetPageHeight().<br>
+- Fixed a bug in SetXY().<br>
+</dd>
+<dt><strong>v1.8</strong> (2015-11-29)</dt>
+<dd>
+- PHP 5.1.0 or higher is now required.<br>
+- The MakeFont utility now subsets fonts, which can greatly reduce font sizes.<br>
+- Added ToUnicode CMaps to improve text extraction.<br>
+- Added a parameter to AddPage() to rotate the page.<br>
+- Added a parameter to SetY() to indicate whether the x position should be reset or not.<br>
+- Added a parameter to Output() to specify the encoding of the name, and special characters are now properly encoded. Additionally the order of the first two parameters was reversed to be more logical (however the old order is still supported for compatibility).<br>
+- The Error() method now throws an exception.<br>
+- Adding contents before the first AddPage() or after Close() now raises an error.<br>
+- Outputting text with no font selected now raises an error.<br>
+</dd>
<dt><strong>v1.7</strong> (2011-06-18)</dt>
<dd>
- The MakeFont utility has been completely rewritten and doesn't depend on ttf2pt1 anymore.<br>
@@ -65,7 +86,7 @@ dd {margin:1em 0 1em 1em} <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> * The line thickness was too large when printed under Windows 98 SE and ME.<br> * 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> * The line thickness was too large when printed under Windows 98 SE and ME.<br> * 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>
diff --git a/pdf/fpdf/doc/__construct.htm b/pdf/fpdf/doc/__construct.htm new file mode 100644 index 0000000..324756f --- /dev/null +++ b/pdf/fpdf/doc/__construct.htm @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>__construct</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>__construct</h1>
+<code>__construct([<b>string</b> orientation [, <b>string</b> unit [, <b>mixed</b> size]]])</code>
+<h2>Description</h2>
+This is the class constructor. It allows to set up the page size, the orientation and the
+unit of measure used in all methods (except for font sizes).
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>orientation</code></dt>
+<dd>
+Default page orientation. Possible values are (case insensitive):
+<ul>
+<li><code>P</code> or <code>Portrait</code></li>
+<li><code>L</code> or <code>Landscape</code></li>
+</ul>
+Default value is <code>P</code>.
+</dd>
+<dt><code>unit</code></dt>
+<dd>
+User unit. Possible values are:
+<ul>
+<li><code>pt</code>: point</li>
+<li><code>mm</code>: millimeter</li>
+<li><code>cm</code>: centimeter</li>
+<li><code>in</code>: inch</li>
+</ul>
+A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This
+is a very common unit in typography; font sizes are expressed in that unit.
+<br>
+<br>
+Default value is <code>mm</code>.
+</dd>
+<dt><code>size</code></dt>
+<dd>
+The size used for pages. It can be either one of the following values (case insensitive):
+<ul>
+<li><code>A3</code></li>
+<li><code>A4</code></li>
+<li><code>A5</code></li>
+<li><code>Letter</code></li>
+<li><code>Legal</code></li>
+</ul>
+or an array containing the width and the height (expressed in the unit given by <code>unit</code>).<br>
+<br>
+Default value is <code>A4</code>.
+</dd>
+</dl>
+<h2>Example</h2>
+Example with a custom 100x150 mm page size:
+<div class="doc-source">
+<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>
+</body>
+</html>
diff --git a/pdf/fpdf/doc/acceptpagebreak.htm b/pdf/fpdf/doc/acceptpagebreak.htm index 810aabd..1b2d3ea 100755..100644 --- a/pdf/fpdf/doc/acceptpagebreak.htm +++ b/pdf/fpdf/doc/acceptpagebreak.htm @@ -52,11 +52,11 @@ $pdf = new PDF(); $pdf->AddPage();
$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();</code></pre>
</div>
<h2>See also</h2>
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/addfont.htm b/pdf/fpdf/doc/addfont.htm index 90dc361..b743191 100755..100644 --- a/pdf/fpdf/doc/addfont.htm +++ b/pdf/fpdf/doc/addfont.htm @@ -48,7 +48,7 @@ is equivalent to: <pre><code>$pdf->AddFont('Comic','I','comici.php');</code></pre>
</div>
<h2>See also</h2>
-<a href="setfont.htm">SetFont()</a>.
+<a href="setfont.htm">SetFont</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/addlink.htm b/pdf/fpdf/doc/addlink.htm index 5681d58..6260664 100755..100644 --- a/pdf/fpdf/doc/addlink.htm +++ b/pdf/fpdf/doc/addlink.htm @@ -15,11 +15,11 @@ which directs to another place within the document. The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is
defined with SetLink().
<h2>See also</h2>
-<a href="cell.htm">Cell()</a>,
-<a href="write.htm">Write()</a>,
-<a href="image.htm">Image()</a>,
-<a href="link.htm">Link()</a>,
-<a href="setlink.htm">SetLink()</a>.
+<a href="cell.htm">Cell</a>,
+<a href="write.htm">Write</a>,
+<a href="image.htm">Image</a>,
+<a href="link.htm">Link</a>,
+<a href="setlink.htm">SetLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/addpage.htm b/pdf/fpdf/doc/addpage.htm index fde79aa..fb014f5 100755..100644 --- a/pdf/fpdf/doc/addpage.htm +++ b/pdf/fpdf/doc/addpage.htm @@ -7,7 +7,7 @@ </head>
<body>
<h1>AddPage</h1>
-<code>AddPage([<b>string</b> orientation [, <b>mixed</b> size]])</code>
+<code>AddPage([<b>string</b> orientation [, <b>mixed</b> size [, <b>int</b> rotation]]])</code>
<h2>Description</h2>
Adds a new page to the document. If a page is already present, the Footer() method is called
first to output the footer. Then the page is added, the current position set to the top-left
@@ -44,12 +44,17 @@ or an array containing the width and the height (expressed in user unit).<br> <br>
The default value is the one passed to the constructor.
</dd>
+<dt><code>rotation</code></dt>
+<dd>
+Angle by which to rotate the page. It must be a multiple of 90; positive values
+mean clockwise rotation. The default value is <code>0</code>.
+</dd>
</dl>
<h2>See also</h2>
-<a href="fpdf.htm">FPDF()</a>,
-<a href="header.htm">Header()</a>,
-<a href="footer.htm">Footer()</a>,
-<a href="setmargins.htm">SetMargins()</a>.
+<a href="__construct.htm">__construct</a>,
+<a href="header.htm">Header</a>,
+<a href="footer.htm">Footer</a>,
+<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/aliasnbpages.htm b/pdf/fpdf/doc/aliasnbpages.htm index 53fdf68..26e02c5 100755..100644 --- a/pdf/fpdf/doc/aliasnbpages.htm +++ b/pdf/fpdf/doc/aliasnbpages.htm @@ -37,8 +37,8 @@ $pdf = new PDF(); $pdf->AliasNbPages();</code></pre>
</div>
<h2>See also</h2>
-<a href="pageno.htm">PageNo()</a>,
-<a href="footer.htm">Footer()</a>.
+<a href="pageno.htm">PageNo</a>,
+<a href="footer.htm">Footer</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/cell.htm b/pdf/fpdf/doc/cell.htm index 7480266..f96effb 100755..100644 --- a/pdf/fpdf/doc/cell.htm +++ b/pdf/fpdf/doc/cell.htm @@ -88,16 +88,16 @@ $pdf->Cell(80); $pdf->Cell(20,10,'Title',1,1,'C');</code></pre>
</div>
<h2>See also</h2>
-<a href="setfont.htm">SetFont()</a>,
-<a href="setdrawcolor.htm">SetDrawColor()</a>,
-<a href="setfillcolor.htm">SetFillColor()</a>,
-<a href="settextcolor.htm">SetTextColor()</a>,
-<a href="setlinewidth.htm">SetLineWidth()</a>,
-<a href="addlink.htm">AddLink()</a>,
-<a href="ln.htm">Ln()</a>,
-<a href="multicell.htm">MultiCell()</a>,
-<a href="write.htm">Write()</a>,
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<a href="setfont.htm">SetFont</a>,
+<a href="setdrawcolor.htm">SetDrawColor</a>,
+<a href="setfillcolor.htm">SetFillColor</a>,
+<a href="settextcolor.htm">SetTextColor</a>,
+<a href="setlinewidth.htm">SetLineWidth</a>,
+<a href="addlink.htm">AddLink</a>,
+<a href="ln.htm">Ln</a>,
+<a href="multicell.htm">MultiCell</a>,
+<a href="write.htm">Write</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/close.htm b/pdf/fpdf/doc/close.htm index 6d8c192..a4055ac 100755..100644 --- a/pdf/fpdf/doc/close.htm +++ b/pdf/fpdf/doc/close.htm @@ -14,7 +14,7 @@ does it automatically. <br>
If the document contains no page, AddPage() is called to prevent from getting an invalid document.
<h2>See also</h2>
-<a href="output.htm">Output()</a>.
+<a href="output.htm">Output</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/error.htm b/pdf/fpdf/doc/error.htm index 49b6083..fbbc263 100755..100644 --- a/pdf/fpdf/doc/error.htm +++ b/pdf/fpdf/doc/error.htm @@ -9,9 +9,10 @@ <h1>Error</h1>
<code>Error(<b>string</b> msg)</code>
<h2>Description</h2>
-This method is automatically called in case of fatal error; it simply outputs the message
-and halts the execution. An inherited class may override it to customize the error handling
-but should always halt the script, or the resulting document would probably be invalid.
+This method is automatically called in case of a fatal error; it simply throws an exception
+with the provided message.<br>
+An inherited class may override it to customize the error handling but the method should
+never return, otherwise the resulting document would probably be invalid.
<h2>Parameters</h2>
<dl class="param">
<dt><code>msg</code></dt>
diff --git a/pdf/fpdf/doc/footer.htm b/pdf/fpdf/doc/footer.htm index 1e4b3ad..bee81cf 100755..100644 --- a/pdf/fpdf/doc/footer.htm +++ b/pdf/fpdf/doc/footer.htm @@ -28,7 +28,7 @@ function Footer() }</code></pre>
</div>
<h2>See also</h2>
-<a href="header.htm">Header()</a>.
+<a href="header.htm">Header</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/getpageheight.htm b/pdf/fpdf/doc/getpageheight.htm new file mode 100644 index 0000000..8cd89ff --- /dev/null +++ b/pdf/fpdf/doc/getpageheight.htm @@ -0,0 +1,18 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>GetPageHeight</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>GetPageHeight</h1>
+<code><b>float</b> GetPageHeight()</code>
+<h2>Description</h2>
+Returns the current page height.
+<h2>See also</h2>
+<a href="getpagewidth.htm">GetPageWidth</a>
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>
diff --git a/pdf/fpdf/doc/getpagewidth.htm b/pdf/fpdf/doc/getpagewidth.htm new file mode 100644 index 0000000..3e898e3 --- /dev/null +++ b/pdf/fpdf/doc/getpagewidth.htm @@ -0,0 +1,18 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>GetPageWidth</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>GetPageWidth</h1>
+<code><b>float</b> GetPageWidth()</code>
+<h2>Description</h2>
+Returns the current page width.
+<h2>See also</h2>
+<a href="getpageheight.htm">GetPageHeight</a>
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>
diff --git a/pdf/fpdf/doc/getstringwidth.htm b/pdf/fpdf/doc/getstringwidth.htm index 7cb1119..7cb1119 100755..100644 --- a/pdf/fpdf/doc/getstringwidth.htm +++ b/pdf/fpdf/doc/getstringwidth.htm diff --git a/pdf/fpdf/doc/getx.htm b/pdf/fpdf/doc/getx.htm index 1d1310c..4272502 100755..100644 --- a/pdf/fpdf/doc/getx.htm +++ b/pdf/fpdf/doc/getx.htm @@ -11,9 +11,9 @@ <h2>Description</h2>
Returns the abscissa of the current position.
<h2>See also</h2>
-<a href="setx.htm">SetX()</a>,
-<a href="gety.htm">GetY()</a>,
-<a href="sety.htm">SetY()</a>.
+<a href="setx.htm">SetX</a>,
+<a href="gety.htm">GetY</a>,
+<a href="sety.htm">SetY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/gety.htm b/pdf/fpdf/doc/gety.htm index e8ce6cf..fb84f5d 100755..100644 --- a/pdf/fpdf/doc/gety.htm +++ b/pdf/fpdf/doc/gety.htm @@ -11,9 +11,9 @@ <h2>Description</h2>
Returns the ordinate of the current position.
<h2>See also</h2>
-<a href="sety.htm">SetY()</a>,
-<a href="getx.htm">GetX()</a>,
-<a href="setx.htm">SetX()</a>.
+<a href="sety.htm">SetY</a>,
+<a href="getx.htm">GetX</a>,
+<a href="setx.htm">SetX</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/header.htm b/pdf/fpdf/doc/header.htm index b7cd1f8..0228159 100755..100644 --- a/pdf/fpdf/doc/header.htm +++ b/pdf/fpdf/doc/header.htm @@ -30,7 +30,7 @@ function Header() }</code></pre>
</div>
<h2>See also</h2>
-<a href="footer.htm">Footer()</a>.
+<a href="footer.htm">Footer</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/image.htm b/pdf/fpdf/doc/image.htm index 66a35ee..53a4ec1 100755..100644 --- a/pdf/fpdf/doc/image.htm +++ b/pdf/fpdf/doc/image.htm @@ -92,7 +92,7 @@ $pdf->Image('logo.png',10,10,-300); $pdf->Image('http://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World',60,30,90,0,'PNG');</code></pre>
</div>
<h2>See also</h2>
-<a href="addlink.htm">AddLink()</a>.
+<a href="addlink.htm">AddLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/index.htm b/pdf/fpdf/doc/index.htm index 6c27066..32ded00 100755..100644 --- a/pdf/fpdf/doc/index.htm +++ b/pdf/fpdf/doc/index.htm @@ -2,11 +2,12 @@ <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>FPDF 1.7 Reference Manual</title>
+<title>FPDF 1.82 Reference Manual</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
-<h1>FPDF 1.7 Reference Manual</h1>
+<h1>FPDF 1.82 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>
<a href="addlink.htm">AddLink</a> - create an internal link<br>
@@ -16,7 +17,8 @@ <a href="close.htm">Close</a> - terminate the document<br>
<a href="error.htm">Error</a> - fatal error<br>
<a href="footer.htm">Footer</a> - page footer<br>
-<a href="fpdf.htm">FPDF</a> - constructor<br>
+<a href="getpageheight.htm">GetPageHeight</a> - get current page height<br>
+<a href="getpagewidth.htm">GetPageWidth</a> - get current page width<br>
<a href="getstringwidth.htm">GetStringWidth</a> - compute string length<br>
<a href="getx.htm">GetX</a> - get current x position<br>
<a href="gety.htm">GetY</a> - get current y position<br>
@@ -50,7 +52,7 @@ <a href="settopmargin.htm">SetTopMargin</a> - set top margin<br>
<a href="setx.htm">SetX</a> - set current x position<br>
<a href="setxy.htm">SetXY</a> - set current x and y positions<br>
-<a href="sety.htm">SetY</a> - set current y position<br>
+<a href="sety.htm">SetY</a> - set current y position and optionally reset x<br>
<a href="text.htm">Text</a> - print a string<br>
<a href="write.htm">Write</a> - print flowing text<br>
</body>
diff --git a/pdf/fpdf/doc/line.htm b/pdf/fpdf/doc/line.htm index a9c5194..f6b70f0 100755..100644 --- a/pdf/fpdf/doc/line.htm +++ b/pdf/fpdf/doc/line.htm @@ -30,8 +30,8 @@ Ordinate of second point. </dd>
</dl>
<h2>See also</h2>
-<a href="setlinewidth.htm">SetLineWidth()</a>,
-<a href="setdrawcolor.htm">SetDrawColor()</a>.
+<a href="setlinewidth.htm">SetLineWidth</a>,
+<a href="setdrawcolor.htm">SetDrawColor</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/link.htm b/pdf/fpdf/doc/link.htm index d6c728c..c8fd1cb 100755..100644 --- a/pdf/fpdf/doc/link.htm +++ b/pdf/fpdf/doc/link.htm @@ -36,10 +36,10 @@ URL or identifier returned by AddLink(). </dd>
</dl>
<h2>See also</h2>
-<a href="addlink.htm">AddLink()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="write.htm">Write()</a>,
-<a href="image.htm">Image()</a>.
+<a href="addlink.htm">AddLink</a>,
+<a href="cell.htm">Cell</a>,
+<a href="write.htm">Write</a>,
+<a href="image.htm">Image</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/ln.htm b/pdf/fpdf/doc/ln.htm index 0b91b00..0183738 100755..100644 --- a/pdf/fpdf/doc/ln.htm +++ b/pdf/fpdf/doc/ln.htm @@ -21,7 +21,7 @@ By default, the value equals the height of the last printed cell. </dd>
</dl>
<h2>See also</h2>
-<a href="cell.htm">Cell()</a>.
+<a href="cell.htm">Cell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/multicell.htm b/pdf/fpdf/doc/multicell.htm index c41bbd7..ce1e4e6 100755..100644 --- a/pdf/fpdf/doc/multicell.htm +++ b/pdf/fpdf/doc/multicell.htm @@ -62,14 +62,14 @@ Default value: <code>false</code>. </dd>
</dl>
<h2>See also</h2>
-<a href="setfont.htm">SetFont()</a>,
-<a href="setdrawcolor.htm">SetDrawColor()</a>,
-<a href="setfillcolor.htm">SetFillColor()</a>,
-<a href="settextcolor.htm">SetTextColor()</a>,
-<a href="setlinewidth.htm">SetLineWidth()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="write.htm">Write()</a>,
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<a href="setfont.htm">SetFont</a>,
+<a href="setdrawcolor.htm">SetDrawColor</a>,
+<a href="setfillcolor.htm">SetFillColor</a>,
+<a href="settextcolor.htm">SetTextColor</a>,
+<a href="setlinewidth.htm">SetLineWidth</a>,
+<a href="cell.htm">Cell</a>,
+<a href="write.htm">Write</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/output.htm b/pdf/fpdf/doc/output.htm index b62291c..9a905a8 100755..100644 --- a/pdf/fpdf/doc/output.htm +++ b/pdf/fpdf/doc/output.htm @@ -7,35 +7,39 @@ </head>
<body>
<h1>Output</h1>
-<code><b>string</b> Output([<b>string</b> name, <b>string</b> dest])</code>
+<code><b>string</b> Output([<b>string</b> dest [, <b>string</b> name [, <b>boolean</b> isUTF8]]])</code>
<h2>Description</h2>
-Send the document to a given destination: browser, file or string. In the case of browser, the
-plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
+Send the document to a given destination: browser, file or string. In the case of a browser, the
+PDF viewer may be used or a download may be forced.
<br>
The method first calls Close() if necessary to terminate the document.
<h2>Parameters</h2>
<dl class="param">
-<dt><code>name</code></dt>
-<dd>
-The name of the file. If not specified, the document will be sent to the browser
-(destination <code>I</code>) with the name <code>doc.pdf</code>.
-</dd>
<dt><code>dest</code></dt>
<dd>
-Destination where to send the document. It can take one of the following values:
+Destination where to send the document. It can be one of the following:
<ul>
-<li><code>I</code>: send the file inline to the browser. The plug-in is used if available.
-The name given by <code>name</code> is used when one selects the "Save as" option on the
-link generating the PDF.</li>
-<li><code>D</code>: send to the browser and force a file download with the name given by
-<code>name</code>.</li>
+<li><code>I</code>: send the file inline to the browser. The PDF viewer is used if available.</li>
+<li><code>D</code>: send to the browser and force a file download with the name given by <code>name</code>.</li>
<li><code>F</code>: save to a local file with the name given by <code>name</code> (may include a path).</li>
-<li><code>S</code>: return the document as a string. <code>name</code> is ignored.</li>
+<li><code>S</code>: return the document as a string.</li>
</ul>
+The default value is <code>I</code>.
+</dd>
+<dt><code>name</code></dt>
+<dd>
+The name of the file. It is ignored in case of destination <code>S</code>.<br>
+The default value is <code>doc.pdf</code>.
+</dd>
+<dt><code>isUTF8</code></dt>
+<dd>
+Indicates if <code>name</code> is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).
+Only used for destinations <code>I</code> and <code>D</code>.<br>
+The default value is <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
-<a href="close.htm">Close()</a>.
+<a href="close.htm">Close</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/pageno.htm b/pdf/fpdf/doc/pageno.htm index 84e0f22..42063c7 100755..100644 --- a/pdf/fpdf/doc/pageno.htm +++ b/pdf/fpdf/doc/pageno.htm @@ -11,7 +11,7 @@ <h2>Description</h2>
Returns the current page number.
<h2>See also</h2>
-<a href="aliasnbpages.htm">AliasNbPages()</a>.
+<a href="aliasnbpages.htm">AliasNbPages</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/rect.htm b/pdf/fpdf/doc/rect.htm index fa71375..0b73acc 100755..100644 --- a/pdf/fpdf/doc/rect.htm +++ b/pdf/fpdf/doc/rect.htm @@ -39,9 +39,9 @@ Style of rendering. Possible values are: </dd>
</dl>
<h2>See also</h2>
-<a href="setlinewidth.htm">SetLineWidth()</a>,
-<a href="setdrawcolor.htm">SetDrawColor()</a>,
-<a href="setfillcolor.htm">SetFillColor()</a>.
+<a href="setlinewidth.htm">SetLineWidth</a>,
+<a href="setdrawcolor.htm">SetDrawColor</a>,
+<a href="setfillcolor.htm">SetFillColor</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setauthor.htm b/pdf/fpdf/doc/setauthor.htm index 60d3b7c..31a0458 100755..100644 --- a/pdf/fpdf/doc/setauthor.htm +++ b/pdf/fpdf/doc/setauthor.htm @@ -23,10 +23,10 @@ Default value: <code>false</code>. </dd>
</dl>
<h2>See also</h2>
-<a href="setcreator.htm">SetCreator()</a>,
-<a href="setkeywords.htm">SetKeywords()</a>,
-<a href="setsubject.htm">SetSubject()</a>,
-<a href="settitle.htm">SetTitle()</a>.
+<a href="setcreator.htm">SetCreator</a>,
+<a href="setkeywords.htm">SetKeywords</a>,
+<a href="setsubject.htm">SetSubject</a>,
+<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setautopagebreak.htm b/pdf/fpdf/doc/setautopagebreak.htm index 71dec89..c8881bf 100755..100644 --- a/pdf/fpdf/doc/setautopagebreak.htm +++ b/pdf/fpdf/doc/setautopagebreak.htm @@ -24,9 +24,9 @@ Distance from the bottom of the page. </dd>
</dl>
<h2>See also</h2>
-<a href="cell.htm">Cell()</a>,
-<a href="multicell.htm">MultiCell()</a>,
-<a href="acceptpagebreak.htm">AcceptPageBreak()</a>.
+<a href="cell.htm">Cell</a>,
+<a href="multicell.htm">MultiCell</a>,
+<a href="acceptpagebreak.htm">AcceptPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setcompression.htm b/pdf/fpdf/doc/setcompression.htm index 3f81ab0..3f81ab0 100755..100644 --- a/pdf/fpdf/doc/setcompression.htm +++ b/pdf/fpdf/doc/setcompression.htm diff --git a/pdf/fpdf/doc/setcreator.htm b/pdf/fpdf/doc/setcreator.htm index 2c0db3c..ce3bcad 100755..100644 --- a/pdf/fpdf/doc/setcreator.htm +++ b/pdf/fpdf/doc/setcreator.htm @@ -24,10 +24,10 @@ Default value: <code>false</code>. </dd>
</dl>
<h2>See also</h2>
-<a href="setauthor.htm">SetAuthor()</a>,
-<a href="setkeywords.htm">SetKeywords()</a>,
-<a href="setsubject.htm">SetSubject()</a>,
-<a href="settitle.htm">SetTitle()</a>.
+<a href="setauthor.htm">SetAuthor</a>,
+<a href="setkeywords.htm">SetKeywords</a>,
+<a href="setsubject.htm">SetSubject</a>,
+<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setdisplaymode.htm b/pdf/fpdf/doc/setdisplaymode.htm index b8da44f..b8da44f 100755..100644 --- a/pdf/fpdf/doc/setdisplaymode.htm +++ b/pdf/fpdf/doc/setdisplaymode.htm diff --git a/pdf/fpdf/doc/setdrawcolor.htm b/pdf/fpdf/doc/setdrawcolor.htm index 6be79c5..f77af0b 100755..100644 --- a/pdf/fpdf/doc/setdrawcolor.htm +++ b/pdf/fpdf/doc/setdrawcolor.htm @@ -29,12 +29,12 @@ Blue component (between 0 and 255). </dd>
</dl>
<h2>See also</h2>
-<a href="setfillcolor.htm">SetFillColor()</a>,
-<a href="settextcolor.htm">SetTextColor()</a>,
-<a href="line.htm">Line()</a>,
-<a href="rect.htm">Rect()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="multicell.htm">MultiCell()</a>.
+<a href="setfillcolor.htm">SetFillColor</a>,
+<a href="settextcolor.htm">SetTextColor</a>,
+<a href="line.htm">Line</a>,
+<a href="rect.htm">Rect</a>,
+<a href="cell.htm">Cell</a>,
+<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setfillcolor.htm b/pdf/fpdf/doc/setfillcolor.htm index 64f66d3..243a432 100755..100644 --- a/pdf/fpdf/doc/setfillcolor.htm +++ b/pdf/fpdf/doc/setfillcolor.htm @@ -29,11 +29,11 @@ Blue component (between 0 and 255). </dd>
</dl>
<h2>See also</h2>
-<a href="setdrawcolor.htm">SetDrawColor()</a>,
-<a href="settextcolor.htm">SetTextColor()</a>,
-<a href="rect.htm">Rect()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="multicell.htm">MultiCell()</a>.
+<a href="setdrawcolor.htm">SetDrawColor</a>,
+<a href="settextcolor.htm">SetTextColor</a>,
+<a href="rect.htm">Rect</a>,
+<a href="cell.htm">Cell</a>,
+<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setfont.htm b/pdf/fpdf/doc/setfont.htm index 1cbae91..cd5a3b8 100755..100644 --- a/pdf/fpdf/doc/setfont.htm +++ b/pdf/fpdf/doc/setfont.htm @@ -81,11 +81,11 @@ $pdf->SetFont(''); $pdf->SetFont('Times','BIU');</code></pre>
</div>
<h2>See also</h2>
-<a href="addfont.htm">AddFont()</a>,
-<a href="setfontsize.htm">SetFontSize()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="multicell.htm">MultiCell()</a>,
-<a href="write.htm">Write()</a>.
+<a href="addfont.htm">AddFont</a>,
+<a href="setfontsize.htm">SetFontSize</a>,
+<a href="cell.htm">Cell</a>,
+<a href="multicell.htm">MultiCell</a>,
+<a href="write.htm">Write</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setfontsize.htm b/pdf/fpdf/doc/setfontsize.htm index 20b35cd..5bb9c39 100755..100644 --- a/pdf/fpdf/doc/setfontsize.htm +++ b/pdf/fpdf/doc/setfontsize.htm @@ -18,7 +18,7 @@ The size (in points). </dd>
</dl>
<h2>See also</h2>
-<a href="setfont.htm">SetFont()</a>.
+<a href="setfont.htm">SetFont</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setkeywords.htm b/pdf/fpdf/doc/setkeywords.htm index 8b8897e..2b095fb 100755..100644 --- a/pdf/fpdf/doc/setkeywords.htm +++ b/pdf/fpdf/doc/setkeywords.htm @@ -23,10 +23,10 @@ Default value: <code>false</code>. </dd>
</dl>
<h2>See also</h2>
-<a href="setauthor.htm">SetAuthor()</a>,
-<a href="setcreator.htm">SetCreator()</a>,
-<a href="setsubject.htm">SetSubject()</a>,
-<a href="settitle.htm">SetTitle()</a>.
+<a href="setauthor.htm">SetAuthor</a>,
+<a href="setcreator.htm">SetCreator</a>,
+<a href="setsubject.htm">SetSubject</a>,
+<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setleftmargin.htm b/pdf/fpdf/doc/setleftmargin.htm index dde7a7c..f071372 100755..100644 --- a/pdf/fpdf/doc/setleftmargin.htm +++ b/pdf/fpdf/doc/setleftmargin.htm @@ -20,10 +20,10 @@ The margin. </dd>
</dl>
<h2>See also</h2>
-<a href="settopmargin.htm">SetTopMargin()</a>,
-<a href="setrightmargin.htm">SetRightMargin()</a>,
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>,
-<a href="setmargins.htm">SetMargins()</a>.
+<a href="settopmargin.htm">SetTopMargin</a>,
+<a href="setrightmargin.htm">SetRightMargin</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>,
+<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setlinewidth.htm b/pdf/fpdf/doc/setlinewidth.htm index 11e417c..6267230 100755..100644 --- a/pdf/fpdf/doc/setlinewidth.htm +++ b/pdf/fpdf/doc/setlinewidth.htm @@ -19,10 +19,10 @@ The width. </dd>
</dl>
<h2>See also</h2>
-<a href="line.htm">Line()</a>,
-<a href="rect.htm">Rect()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="multicell.htm">MultiCell()</a>.
+<a href="line.htm">Line</a>,
+<a href="rect.htm">Rect</a>,
+<a href="cell.htm">Cell</a>,
+<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setlink.htm b/pdf/fpdf/doc/setlink.htm index b524525..6767948 100755..100644 --- a/pdf/fpdf/doc/setlink.htm +++ b/pdf/fpdf/doc/setlink.htm @@ -27,7 +27,7 @@ Number of target page; <code>-1</code> indicates the current page. This is the d </dd>
</dl>
<h2>See also</h2>
-<a href="addlink.htm">AddLink()</a>.
+<a href="addlink.htm">AddLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setmargins.htm b/pdf/fpdf/doc/setmargins.htm index 7cc8c6d..7dff53b 100755..100644 --- a/pdf/fpdf/doc/setmargins.htm +++ b/pdf/fpdf/doc/setmargins.htm @@ -27,10 +27,10 @@ Right margin. Default value is the left one. </dd>
</dl>
<h2>See also</h2>
-<a href="setleftmargin.htm">SetLeftMargin()</a>,
-<a href="settopmargin.htm">SetTopMargin()</a>,
-<a href="setrightmargin.htm">SetRightMargin()</a>,
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<a href="setleftmargin.htm">SetLeftMargin</a>,
+<a href="settopmargin.htm">SetTopMargin</a>,
+<a href="setrightmargin.htm">SetRightMargin</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setrightmargin.htm b/pdf/fpdf/doc/setrightmargin.htm index 7915647..e362caa 100755..100644 --- a/pdf/fpdf/doc/setrightmargin.htm +++ b/pdf/fpdf/doc/setrightmargin.htm @@ -18,10 +18,10 @@ The margin. </dd>
</dl>
<h2>See also</h2>
-<a href="setleftmargin.htm">SetLeftMargin()</a>,
-<a href="settopmargin.htm">SetTopMargin()</a>,
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>,
-<a href="setmargins.htm">SetMargins()</a>.
+<a href="setleftmargin.htm">SetLeftMargin</a>,
+<a href="settopmargin.htm">SetTopMargin</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>,
+<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setsubject.htm b/pdf/fpdf/doc/setsubject.htm index e8c628c..a0e5be5 100755..100644 --- a/pdf/fpdf/doc/setsubject.htm +++ b/pdf/fpdf/doc/setsubject.htm @@ -23,10 +23,10 @@ Default value: <code>false</code>. </dd>
</dl>
<h2>See also</h2>
-<a href="setauthor.htm">SetAuthor()</a>,
-<a href="setcreator.htm">SetCreator()</a>,
-<a href="setkeywords.htm">SetKeywords()</a>,
-<a href="settitle.htm">SetTitle()</a>.
+<a href="setauthor.htm">SetAuthor</a>,
+<a href="setcreator.htm">SetCreator</a>,
+<a href="setkeywords.htm">SetKeywords</a>,
+<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/settextcolor.htm b/pdf/fpdf/doc/settextcolor.htm index cb12fec..88dc0d3 100755..100644 --- a/pdf/fpdf/doc/settextcolor.htm +++ b/pdf/fpdf/doc/settextcolor.htm @@ -29,11 +29,11 @@ Blue component (between 0 and 255). </dd>
</dl>
<h2>See also</h2>
-<a href="setdrawcolor.htm">SetDrawColor()</a>,
-<a href="setfillcolor.htm">SetFillColor()</a>,
-<a href="text.htm">Text()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="multicell.htm">MultiCell()</a>.
+<a href="setdrawcolor.htm">SetDrawColor</a>,
+<a href="setfillcolor.htm">SetFillColor</a>,
+<a href="text.htm">Text</a>,
+<a href="cell.htm">Cell</a>,
+<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/settitle.htm b/pdf/fpdf/doc/settitle.htm index 3bc0fe8..977646b 100755..100644 --- a/pdf/fpdf/doc/settitle.htm +++ b/pdf/fpdf/doc/settitle.htm @@ -23,10 +23,10 @@ Default value: <code>false</code>. </dd>
</dl>
<h2>See also</h2>
-<a href="setauthor.htm">SetAuthor()</a>,
-<a href="setcreator.htm">SetCreator()</a>,
-<a href="setkeywords.htm">SetKeywords()</a>,
-<a href="setsubject.htm">SetSubject()</a>.
+<a href="setauthor.htm">SetAuthor</a>,
+<a href="setcreator.htm">SetCreator</a>,
+<a href="setkeywords.htm">SetKeywords</a>,
+<a href="setsubject.htm">SetSubject</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/settopmargin.htm b/pdf/fpdf/doc/settopmargin.htm index 65a4b7d..4d94e76 100755..100644 --- a/pdf/fpdf/doc/settopmargin.htm +++ b/pdf/fpdf/doc/settopmargin.htm @@ -18,10 +18,10 @@ The margin. </dd>
</dl>
<h2>See also</h2>
-<a href="setleftmargin.htm">SetLeftMargin()</a>,
-<a href="setrightmargin.htm">SetRightMargin()</a>,
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>,
-<a href="setmargins.htm">SetMargins()</a>.
+<a href="setleftmargin.htm">SetLeftMargin</a>,
+<a href="setrightmargin.htm">SetRightMargin</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>,
+<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setx.htm b/pdf/fpdf/doc/setx.htm index 7c92465..76eec7c 100755..100644 --- a/pdf/fpdf/doc/setx.htm +++ b/pdf/fpdf/doc/setx.htm @@ -19,10 +19,10 @@ The value of the abscissa. </dd>
</dl>
<h2>See also</h2>
-<a href="getx.htm">GetX()</a>,
-<a href="gety.htm">GetY()</a>,
-<a href="sety.htm">SetY()</a>,
-<a href="setxy.htm">SetXY()</a>.
+<a href="getx.htm">GetX</a>,
+<a href="gety.htm">GetY</a>,
+<a href="sety.htm">SetY</a>,
+<a href="setxy.htm">SetXY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/setxy.htm b/pdf/fpdf/doc/setxy.htm index c0602e5..57b83c2 100755..100644 --- a/pdf/fpdf/doc/setxy.htm +++ b/pdf/fpdf/doc/setxy.htm @@ -23,8 +23,8 @@ The value of the ordinate. </dd>
</dl>
<h2>See also</h2>
-<a href="setx.htm">SetX()</a>,
-<a href="sety.htm">SetY()</a>.
+<a href="setx.htm">SetX</a>,
+<a href="sety.htm">SetY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/sety.htm b/pdf/fpdf/doc/sety.htm index e9afe11..f970685 100755..100644 --- a/pdf/fpdf/doc/sety.htm +++ b/pdf/fpdf/doc/sety.htm @@ -7,9 +7,9 @@ </head>
<body>
<h1>SetY</h1>
-<code>SetY(<b>float</b> y)</code>
+<code>SetY(<b>float</b> y [, <b>boolean</b> resetX])</code>
<h2>Description</h2>
-Moves the current abscissa back to the left margin and sets the ordinate. If the passed value
+Sets the ordinate and optionally moves the current abscissa back to the left margin. If the value
is negative, it is relative to the bottom of the page.
<h2>Parameters</h2>
<dl class="param">
@@ -17,12 +17,16 @@ is negative, it is relative to the bottom of the page. <dd>
The value of the ordinate.
</dd>
+<dt><code>resetX</code></dt>
+<dd>
+Whether to reset the abscissa. Default value: <code>true</code>.
+</dd>
</dl>
<h2>See also</h2>
-<a href="getx.htm">GetX()</a>,
-<a href="gety.htm">GetY()</a>,
-<a href="setx.htm">SetX()</a>,
-<a href="setxy.htm">SetXY()</a>.
+<a href="getx.htm">GetX</a>,
+<a href="gety.htm">GetY</a>,
+<a href="setx.htm">SetX</a>,
+<a href="setxy.htm">SetXY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/text.htm b/pdf/fpdf/doc/text.htm index ccd86eb..25f69b3 100755..100644 --- a/pdf/fpdf/doc/text.htm +++ b/pdf/fpdf/doc/text.htm @@ -28,11 +28,11 @@ String to print. </dd>
</dl>
<h2>See also</h2>
-<a href="setfont.htm">SetFont()</a>,
-<a href="settextcolor.htm">SetTextColor()</a>,
-<a href="cell.htm">Cell()</a>,
-<a href="multicell.htm">MultiCell()</a>,
-<a href="write.htm">Write()</a>.
+<a href="setfont.htm">SetFont</a>,
+<a href="settextcolor.htm">SetTextColor</a>,
+<a href="cell.htm">Cell</a>,
+<a href="multicell.htm">MultiCell</a>,
+<a href="write.htm">Write</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/doc/write.htm b/pdf/fpdf/doc/write.htm index 162476b..bd85401 100755..100644 --- a/pdf/fpdf/doc/write.htm +++ b/pdf/fpdf/doc/write.htm @@ -40,11 +40,11 @@ $pdf->SetFont('','U'); $pdf->Write(5,'www.fpdf.org','http://www.fpdf.org');</code></pre>
</div>
<h2>See also</h2>
-<a href="setfont.htm">SetFont()</a>,
-<a href="settextcolor.htm">SetTextColor()</a>,
-<a href="addlink.htm">AddLink()</a>,
-<a href="multicell.htm">MultiCell()</a>,
-<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<a href="setfont.htm">SetFont</a>,
+<a href="settextcolor.htm">SetTextColor</a>,
+<a href="addlink.htm">AddLink</a>,
+<a href="multicell.htm">MultiCell</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
diff --git a/pdf/fpdf/font/courier.php b/pdf/fpdf/font/courier.php index 213bf35..67dbeda 100755..100644 --- a/pdf/fpdf/font/courier.php +++ b/pdf/fpdf/font/courier.php @@ -5,4 +5,6 @@ $up = -100; $ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/courierb.php b/pdf/fpdf/font/courierb.php index 3fc69a5..62550a4 100755..100644 --- a/pdf/fpdf/font/courierb.php +++ b/pdf/fpdf/font/courierb.php @@ -5,4 +5,6 @@ $up = -100; $ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/courierbi.php b/pdf/fpdf/font/courierbi.php index a49f2ae..6a3ecc6 100755..100644 --- a/pdf/fpdf/font/courierbi.php +++ b/pdf/fpdf/font/courierbi.php @@ -5,4 +5,6 @@ $up = -100; $ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/courieri.php b/pdf/fpdf/font/courieri.php index 9c1c2cf..b88e098 100755..100644 --- a/pdf/fpdf/font/courieri.php +++ b/pdf/fpdf/font/courieri.php @@ -5,4 +5,6 @@ $up = -100; $ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/helvetica.php b/pdf/fpdf/font/helvetica.php index 7e20c3a..2be3eca 100755..100644 --- a/pdf/fpdf/font/helvetica.php +++ b/pdf/fpdf/font/helvetica.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/helveticab.php b/pdf/fpdf/font/helveticab.php index 452e0ac..c88394c 100755..100644 --- a/pdf/fpdf/font/helveticab.php +++ b/pdf/fpdf/font/helveticab.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/helveticabi.php b/pdf/fpdf/font/helveticabi.php index ea5c56f..bcea807 100755..100644 --- a/pdf/fpdf/font/helveticabi.php +++ b/pdf/fpdf/font/helveticabi.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/helveticai.php b/pdf/fpdf/font/helveticai.php index e3c638a..a328b04 100755..100644 --- a/pdf/fpdf/font/helveticai.php +++ b/pdf/fpdf/font/helveticai.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/symbol.php b/pdf/fpdf/font/symbol.php index b980b07..5b9147b 100755..100644 --- a/pdf/fpdf/font/symbol.php +++ b/pdf/fpdf/font/symbol.php @@ -16,4 +16,5 @@ $cw = array( chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,
chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,
chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);
+$uv = array(32=>160,33=>33,34=>8704,35=>35,36=>8707,37=>array(37,2),39=>8715,40=>array(40,2),42=>8727,43=>array(43,2),45=>8722,46=>array(46,18),64=>8773,65=>array(913,2),67=>935,68=>array(916,2),70=>934,71=>915,72=>919,73=>921,74=>977,75=>array(922,4),79=>array(927,2),81=>920,82=>929,83=>array(931,3),86=>962,87=>937,88=>926,89=>936,90=>918,91=>91,92=>8756,93=>93,94=>8869,95=>95,96=>63717,97=>array(945,2),99=>967,100=>array(948,2),102=>966,103=>947,104=>951,105=>953,106=>981,107=>array(954,4),111=>array(959,2),113=>952,114=>961,115=>array(963,3),118=>982,119=>969,120=>958,121=>968,122=>950,123=>array(123,3),126=>8764,160=>8364,161=>978,162=>8242,163=>8804,164=>8725,165=>8734,166=>402,167=>9827,168=>9830,169=>9829,170=>9824,171=>8596,172=>array(8592,4),176=>array(176,2),178=>8243,179=>8805,180=>215,181=>8733,182=>8706,183=>8226,184=>247,185=>array(8800,2),187=>8776,188=>8230,189=>array(63718,2),191=>8629,192=>8501,193=>8465,194=>8476,195=>8472,196=>8855,197=>8853,198=>8709,199=>array(8745,2),201=>8835,202=>8839,203=>8836,204=>8834,205=>8838,206=>array(8712,2),208=>8736,209=>8711,210=>63194,211=>63193,212=>63195,213=>8719,214=>8730,215=>8901,216=>172,217=>array(8743,2),219=>8660,220=>array(8656,4),224=>9674,225=>9001,226=>array(63720,3),229=>8721,230=>array(63723,10),241=>9002,242=>8747,243=>8992,244=>63733,245=>8993,246=>array(63734,9));
?>
diff --git a/pdf/fpdf/font/times.php b/pdf/fpdf/font/times.php index d3ea808..f78850f 100755..100644 --- a/pdf/fpdf/font/times.php +++ b/pdf/fpdf/font/times.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/timesb.php b/pdf/fpdf/font/timesb.php index 1c198f0..0516750 100755..100644 --- a/pdf/fpdf/font/timesb.php +++ b/pdf/fpdf/font/timesb.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/timesbi.php b/pdf/fpdf/font/timesbi.php index a6034b2..32fe25e 100755..100644 --- a/pdf/fpdf/font/timesbi.php +++ b/pdf/fpdf/font/timesbi.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/timesi.php b/pdf/fpdf/font/timesi.php index bd9e0d9..b0e5a62 100755..100644 --- a/pdf/fpdf/font/timesi.php +++ b/pdf/fpdf/font/timesi.php @@ -16,4 +16,6 @@ $cw = array( chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);
+$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
?>
diff --git a/pdf/fpdf/font/zapfdingbats.php b/pdf/fpdf/font/zapfdingbats.php index afef4d3..b9d0309 100755..100644 --- a/pdf/fpdf/font/zapfdingbats.php +++ b/pdf/fpdf/font/zapfdingbats.php @@ -16,4 +16,5 @@ $cw = array( chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
+$uv = array(32=>32,33=>array(9985,4),37=>9742,38=>array(9990,4),42=>9755,43=>9758,44=>array(9996,28),72=>9733,73=>array(10025,35),108=>9679,109=>10061,110=>9632,111=>array(10063,4),115=>9650,116=>9660,117=>9670,118=>10070,119=>9687,120=>array(10072,7),128=>array(10088,14),161=>array(10081,7),168=>9827,169=>9830,170=>9829,171=>9824,172=>array(9312,10),182=>array(10102,31),213=>8594,214=>array(8596,2),216=>array(10136,24),241=>array(10161,14));
?>
diff --git a/pdf/fpdf/fpdf.css b/pdf/fpdf/fpdf.css index 5db3377..dd2c540 100755..100644 --- a/pdf/fpdf/fpdf.css +++ b/pdf/fpdf/fpdf.css @@ -1,6 +1,6 @@ body {font-family:"Times New Roman",serif}
h1 {font:bold 135% Arial,sans-serif; color:#4000A0; margin-bottom:0.9em}
-h2 {font:bold 100% Arial,sans-serif; color:#900000; margin-top:1.5em}
+h2 {font:bold 95% Arial,sans-serif; color:#900000; margin-top:1.5em; margin-bottom:1em}
dl.param dt {text-decoration:underline}
dl.param dd {margin-top:1em; margin-bottom:1em}
dl.param ul {margin-top:1em; margin-bottom:1em}
diff --git a/pdf/fpdf/fpdf.php b/pdf/fpdf/fpdf.php index 86152ec..eb64d15 100755..100644 --- a/pdf/fpdf/fpdf.php +++ b/pdf/fpdf/fpdf.php @@ -2,91 +2,90 @@ /*******************************************************************************
* FPDF *
* *
-* Version: 1.7 *
-* Date: 2011-06-18 *
+* Version: 1.82 *
+* Date: 2019-12-07 *
* Author: Olivier PLATHEY *
*******************************************************************************/
-define('FPDF_VERSION','1.7');
+define('FPDF_VERSION','1.82');
class FPDF
{
-var $page; // current page number
-var $n; // current object number
-var $offsets; // array of object offsets
-var $buffer; // buffer holding in-memory PDF
-var $pages; // array containing pages
-var $state; // current document state
-var $compress; // compression flag
-var $k; // scale factor (number of points in user unit)
-var $DefOrientation; // default orientation
-var $CurOrientation; // current orientation
-var $StdPageSizes; // standard page sizes
-var $DefPageSize; // default page size
-var $CurPageSize; // current page size
-var $PageSizes; // used for pages with non default sizes or orientations
-var $wPt, $hPt; // dimensions of current page in points
-var $w, $h; // dimensions of current page in user unit
-var $lMargin; // left margin
-var $tMargin; // top margin
-var $rMargin; // right margin
-var $bMargin; // page break margin
-var $cMargin; // cell margin
-var $x, $y; // current position in user unit
-var $lasth; // height of last printed cell
-var $LineWidth; // line width in user unit
-var $fontpath; // path containing fonts
-var $CoreFonts; // array of core font names
-var $fonts; // array of used fonts
-var $FontFiles; // array of font files
-var $diffs; // array of encoding differences
-var $FontFamily; // current font family
-var $FontStyle; // current font style
-var $underline; // underlining flag
-var $CurrentFont; // current font info
-var $FontSizePt; // current font size in points
-var $FontSize; // current font size in user unit
-var $DrawColor; // commands for drawing color
-var $FillColor; // commands for filling color
-var $TextColor; // commands for text color
-var $ColorFlag; // indicates whether fill and text colors are different
-var $ws; // word spacing
-var $images; // array of used images
-var $PageLinks; // array of links in pages
-var $links; // array of internal links
-var $AutoPageBreak; // automatic page breaking
-var $PageBreakTrigger; // threshold used to trigger page breaks
-var $InHeader; // flag set when processing header
-var $InFooter; // flag set when processing footer
-var $ZoomMode; // zoom display mode
-var $LayoutMode; // layout display mode
-var $title; // title
-var $subject; // subject
-var $author; // author
-var $keywords; // keywords
-var $creator; // creator
-var $AliasNbPages; // alias for total number of pages
-var $PDFVersion; // PDF version number
+protected $page; // current page number
+protected $n; // current object number
+protected $offsets; // array of object offsets
+protected $buffer; // buffer holding in-memory PDF
+protected $pages; // array containing pages
+protected $state; // current document state
+protected $compress; // compression flag
+protected $k; // scale factor (number of points in user unit)
+protected $DefOrientation; // default orientation
+protected $CurOrientation; // current orientation
+protected $StdPageSizes; // standard page sizes
+protected $DefPageSize; // default page size
+protected $CurPageSize; // current page size
+protected $CurRotation; // current page rotation
+protected $PageInfo; // page-related data
+protected $wPt, $hPt; // dimensions of current page in points
+protected $w, $h; // dimensions of current page in user unit
+protected $lMargin; // left margin
+protected $tMargin; // top margin
+protected $rMargin; // right margin
+protected $bMargin; // page break margin
+protected $cMargin; // cell margin
+protected $x, $y; // current position in user unit
+protected $lasth; // height of last printed cell
+protected $LineWidth; // line width in user unit
+protected $fontpath; // path containing fonts
+protected $CoreFonts; // array of core font names
+protected $fonts; // array of used fonts
+protected $FontFiles; // array of font files
+protected $encodings; // array of encodings
+protected $cmaps; // array of ToUnicode CMaps
+protected $FontFamily; // current font family
+protected $FontStyle; // current font style
+protected $underline; // underlining flag
+protected $CurrentFont; // current font info
+protected $FontSizePt; // current font size in points
+protected $FontSize; // current font size in user unit
+protected $DrawColor; // commands for drawing color
+protected $FillColor; // commands for filling color
+protected $TextColor; // commands for text color
+protected $ColorFlag; // indicates whether fill and text colors are different
+protected $WithAlpha; // indicates whether alpha channel is used
+protected $ws; // word spacing
+protected $images; // array of used images
+protected $PageLinks; // array of links in pages
+protected $links; // array of internal links
+protected $AutoPageBreak; // automatic page breaking
+protected $PageBreakTrigger; // threshold used to trigger page breaks
+protected $InHeader; // flag set when processing header
+protected $InFooter; // flag set when processing footer
+protected $AliasNbPages; // alias for total number of pages
+protected $ZoomMode; // zoom display mode
+protected $LayoutMode; // layout display mode
+protected $metadata; // document properties
+protected $PDFVersion; // PDF version number
/*******************************************************************************
-* *
* Public methods *
-* *
*******************************************************************************/
-function FPDF($orientation='P', $unit='mm', $size='A4')
+
+function __construct($orientation='P', $unit='mm', $size='A4')
{
// Some checks
$this->_dochecks();
// Initialization of properties
+ $this->state = 0;
$this->page = 0;
$this->n = 2;
$this->buffer = '';
$this->pages = array();
- $this->PageSizes = array();
- $this->state = 0;
+ $this->PageInfo = array();
$this->fonts = array();
$this->FontFiles = array();
- $this->diffs = array();
+ $this->encodings = array();
+ $this->cmaps = array();
$this->images = array();
$this->links = array();
$this->InHeader = false;
@@ -100,6 +99,7 @@ function FPDF($orientation='P', $unit='mm', $size='A4') $this->FillColor = '0 g';
$this->TextColor = '0 g';
$this->ColorFlag = false;
+ $this->WithAlpha = false;
$this->ws = 0;
// Font path
if(defined('FPDF_FONTPATH'))
@@ -112,8 +112,6 @@ function FPDF($orientation='P', $unit='mm', $size='A4') $this->fontpath = dirname(__FILE__).'/font/';
else
$this->fontpath = '';
-
-
// Core fonts
$this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
// Scale factor
@@ -152,6 +150,8 @@ function FPDF($orientation='P', $unit='mm', $size='A4') $this->CurOrientation = $this->DefOrientation;
$this->wPt = $this->w*$this->k;
$this->hPt = $this->h*$this->k;
+ // Page rotation
+ $this->CurRotation = 0;
// Page margins (1 cm)
$margin = 28.35/$this->k;
$this->SetMargins($margin,$margin);
@@ -232,41 +232,31 @@ function SetCompression($compress) function SetTitle($title, $isUTF8=false)
{
// Title of document
- if($isUTF8)
- $title = $this->_UTF8toUTF16($title);
- $this->title = $title;
+ $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title);
}
-function SetSubject($subject, $isUTF8=false)
+function SetAuthor($author, $isUTF8=false)
{
- // Subject of document
- if($isUTF8)
- $subject = $this->_UTF8toUTF16($subject);
- $this->subject = $subject;
+ // Author of document
+ $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author);
}
-function SetAuthor($author, $isUTF8=false)
+function SetSubject($subject, $isUTF8=false)
{
- // Author of document
- if($isUTF8)
- $author = $this->_UTF8toUTF16($author);
- $this->author = $author;
+ // Subject of document
+ $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject);
}
function SetKeywords($keywords, $isUTF8=false)
{
// Keywords of document
- if($isUTF8)
- $keywords = $this->_UTF8toUTF16($keywords);
- $this->keywords = $keywords;
+ $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords);
}
function SetCreator($creator, $isUTF8=false)
{
// Creator of document
- if($isUTF8)
- $creator = $this->_UTF8toUTF16($creator);
- $this->creator = $creator;
+ $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator);
}
function AliasNbPages($alias='{nb}')
@@ -278,13 +268,7 @@ function AliasNbPages($alias='{nb}') function Error($msg)
{
// Fatal error
- die('<b>FPDF error:</b> '.$msg);
-}
-
-function Open()
-{
- // Begin document
- $this->state = 1;
+ throw new Exception('FPDF error: '.$msg);
}
function Close()
@@ -304,11 +288,11 @@ function Close() $this->_enddoc();
}
-function AddPage($orientation='', $size='')
+function AddPage($orientation='', $size='', $rotation=0)
{
// Start a new page
- if($this->state==0)
- $this->Open();
+ if($this->state==3)
+ $this->Error('The document is closed');
$family = $this->FontFamily;
$style = $this->FontStyle.($this->underline ? 'U' : '');
$fontsize = $this->FontSizePt;
@@ -327,7 +311,7 @@ function AddPage($orientation='', $size='') $this->_endpage();
}
// Start new page
- $this->_beginpage($orientation,$size);
+ $this->_beginpage($orientation,$size,$rotation);
// Set line cap style to square
$this->_out('2 J');
// Set line width
@@ -472,20 +456,8 @@ function AddFont($family, $style='', $file='') $fontkey = $family.$style;
if(isset($this->fonts[$fontkey]))
return;
-
$info = $this->_loadfont($file);
$info['i'] = count($this->fonts)+1;
- if(!empty($info['diff']))
- {
- // Search existing encodings
- $n = array_search($info['diff'],$this->diffs);
- if(!$n)
- {
- $n = count($this->diffs)+1;
- $this->diffs[$n] = $info['diff'];
- }
- $info['diffn'] = $n;
- }
if(!empty($info['file']))
{
// Embedded font
@@ -585,6 +557,8 @@ function Link($x, $y, $w, $h, $link) function Text($x, $y, $txt)
{
// Output a string
+ if(!isset($this->CurrentFont))
+ $this->Error('No font has been set');
$s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
if($this->underline && $txt!='')
$s .= ' '.$this->_dounderline($x,$y,$txt);
@@ -613,7 +587,7 @@ function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link $this->ws = 0;
$this->_out('0 Tw');
}
- $this->AddPage($this->CurOrientation,$this->CurPageSize);
+ $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation);
$this->x = $x;
if($ws>0)
{
@@ -647,6 +621,8 @@ function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link }
if($txt!=='')
{
+ if(!isset($this->CurrentFont))
+ $this->Error('No font has been set');
if($align=='R')
$dx = $w-$this->cMargin-$this->GetStringWidth($txt);
elseif($align=='C')
@@ -655,8 +631,7 @@ function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link $dx = $this->cMargin;
if($this->ColorFlag)
$s .= 'q '.$this->TextColor.' ';
- $txt2 = str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
- $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
+ $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt));
if($this->underline)
$s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
if($this->ColorFlag)
@@ -681,6 +656,8 @@ function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link 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'];
if($w==0)
$w = $this->w-$this->rMargin-$this->x;
@@ -794,6 +771,8 @@ function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) 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'];
$w = $this->w-$this->rMargin-$this->x;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
@@ -811,7 +790,7 @@ function Write($h, $txt, $link='') if($c=="\n")
{
// Explicit line break
- $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+ $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
$i++;
$sep = -1;
$j = $i;
@@ -846,11 +825,11 @@ function Write($h, $txt, $link='') }
if($i==$j)
$i++;
- $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+ $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
}
else
{
- $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
+ $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link);
$i = $sep+1;
}
$sep = -1;
@@ -869,12 +848,12 @@ function Write($h, $txt, $link='') }
// Last chunk
if($i!=$j)
- $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link);
+ $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
}
function Ln($h=null)
{
- // Line feed; default value is last cell height
+ // Line feed; default value is the last cell height
$this->x = $this->lMargin;
if($h===null)
$this->y += $this->lasth;
@@ -885,6 +864,8 @@ function Ln($h=null) function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='')
{
// Put an image on the page
+ if($file=='')
+ $this->Error('Image file name is empty');
if(!isset($this->images[$file]))
{
// First use of this image, get info
@@ -931,7 +912,7 @@ function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') {
// Automatic page break
$x2 = $this->x;
- $this->AddPage($this->CurOrientation,$this->CurPageSize);
+ $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation);
$this->x = $x2;
}
$y = $this->y;
@@ -945,6 +926,18 @@ function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') $this->Link($x,$y,$w,$h,$link);
}
+function GetPageWidth()
+{
+ // Get current page width
+ return $this->w;
+}
+
+function GetPageHeight()
+{
+ // Get current page height
+ return $this->h;
+}
+
function GetX()
{
// Get x position
@@ -966,40 +959,40 @@ function GetY() return $this->y;
}
-function SetY($y)
+function SetY($y, $resetX=true)
{
- // Set y position and reset x
- $this->x = $this->lMargin;
+ // Set y position and optionally reset x
if($y>=0)
$this->y = $y;
else
$this->y = $this->h+$y;
+ if($resetX)
+ $this->x = $this->lMargin;
}
function SetXY($x, $y)
{
// Set x and y positions
- $this->SetY($y);
$this->SetX($x);
+ $this->SetY($y,false);
}
-function Output($name='', $dest='')
+function Output($dest='', $name='', $isUTF8=false)
{
// Output PDF to some destination
- if($this->state<3)
- $this->Close();
- $dest = strtoupper($dest);
- if($dest=='')
+ $this->Close();
+ if(strlen($name)==1 && strlen($dest)!=1)
{
- if($name=='')
- {
- $name = 'Scilab-Textbook-Certificate.pdf';
- $dest = 'I';
- }
- else
- $dest = 'F';
+ // Fix parameter order
+ $tmp = $dest;
+ $dest = $name;
+ $name = $tmp;
}
- switch($dest)
+ if($dest=='')
+ $dest = 'I';
+ if($name=='')
+ $name = 'doc.pdf';
+ switch(strtoupper($dest))
{
case 'I':
// Send to standard output
@@ -1008,7 +1001,7 @@ function Output($name='', $dest='') {
// We send to a browser
header('Content-Type: application/pdf');
- header('Content-Disposition: inline; filename="'.$name.'"');
+ header('Content-Disposition: inline; '.$this->_httpencode('filename',$name,$isUTF8));
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
}
@@ -1018,18 +1011,15 @@ function Output($name='', $dest='') // Download file
$this->_checkoutput();
header('Content-Type: application/x-download');
- header('Content-Disposition: attachment; filename="'.$name.'"');
+ header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8));
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
echo $this->buffer;
break;
case 'F':
// Save to local file
- $f = fopen($name,'wb');
- if(!$f)
+ if(!file_put_contents($name,$this->buffer))
$this->Error('Unable to create output file: '.$name);
- fwrite($f,$this->buffer,strlen($this->buffer));
- fclose($f);
break;
case 'S':
// Return as a string
@@ -1041,24 +1031,17 @@ function Output($name='', $dest='') }
/*******************************************************************************
-* *
* Protected methods *
-* *
*******************************************************************************/
-function _dochecks()
+
+protected function _dochecks()
{
- // Check availability of %F
- if(sprintf('%.1F',1.0)!='1.0')
- $this->Error('This version of PHP is not supported');
// Check mbstring overloading
if(ini_get('mbstring.func_overload') & 2)
$this->Error('mbstring overloading must be disabled');
- // Ensure runtime magic quotes are disabled
- if(get_magic_quotes_runtime())
- @set_magic_quotes_runtime(0);
}
-function _checkoutput()
+protected function _checkoutput()
{
if(PHP_SAPI!='cli')
{
@@ -1078,7 +1061,7 @@ function _checkoutput() }
}
-function _getpagesize($size)
+protected function _getpagesize($size)
{
if(is_string($size))
{
@@ -1097,7 +1080,7 @@ function _getpagesize($size) }
}
-function _beginpage($orientation, $size)
+protected function _beginpage($orientation, $size, $rotation)
{
$this->page++;
$this->pages[$this->page] = '';
@@ -1134,41 +1117,62 @@ function _beginpage($orientation, $size) $this->CurPageSize = $size;
}
if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1])
- $this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
+ $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt);
+ if($rotation!=0)
+ {
+ if($rotation%90!=0)
+ $this->Error('Incorrect rotation value: '.$rotation);
+ $this->CurRotation = $rotation;
+ $this->PageInfo[$this->page]['rotation'] = $rotation;
+ }
}
-function _endpage()
+protected function _endpage()
{
$this->state = 1;
}
-function _loadfont($font)
+protected function _loadfont($font)
{
// Load a font definition file from the font directory
+ if(strpos($font,'/')!==false || strpos($font,"\\")!==false)
+ $this->Error('Incorrect font definition file name: '.$font);
include($this->fontpath.$font);
- $a = get_defined_vars();
- if(!isset($a['name']))
+ if(!isset($name))
$this->Error('Could not include font definition file');
- return $a;
+ if(isset($enc))
+ $enc = strtolower($enc);
+ if(!isset($subsetted))
+ $subsetted = false;
+ return get_defined_vars();
}
-function _escape($s)
+protected function _isascii($s)
{
- // Escape special characters in strings
- $s = str_replace('\\','\\\\',$s);
- $s = str_replace('(','\\(',$s);
- $s = str_replace(')','\\)',$s);
- $s = str_replace("\r",'\\r',$s);
- return $s;
+ // Test if string is ASCII
+ $nb = strlen($s);
+ for($i=0;$i<$nb;$i++)
+ {
+ if(ord($s[$i])>127)
+ return false;
+ }
+ return true;
}
-function _textstring($s)
+protected function _httpencode($param, $value, $isUTF8)
{
- // Format a text string
- return '('.$this->_escape($s).')';
+ // Encode HTTP header field parameter
+ 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);
}
-function _UTF8toUTF16($s)
+protected function _UTF8toUTF16($s)
{
// Convert UTF-8 to UTF-16BE with BOM
$res = "\xFE\xFF";
@@ -1201,7 +1205,24 @@ function _UTF8toUTF16($s) return $res;
}
-function _dounderline($x, $y, $txt)
+protected function _escape($s)
+{
+ // Escape special characters
+ if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false)
+ return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
+ else
+ return $s;
+}
+
+protected function _textstring($s)
+{
+ // Format a text string
+ if(!$this->_isascii($s))
+ $s = $this->_UTF8toUTF16($s);
+ return '('.$this->_escape($s).')';
+}
+
+protected function _dounderline($x, $y, $txt)
{
// Underline text
$up = $this->CurrentFont['up'];
@@ -1210,7 +1231,7 @@ function _dounderline($x, $y, $txt) return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
}
-function _parsejpg($file)
+protected function _parsejpg($file)
{
// Extract info from a JPEG file
$a = getimagesize($file);
@@ -1229,7 +1250,7 @@ function _parsejpg($file) return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
}
-function _parsepng($file)
+protected function _parsepng($file)
{
// Extract info from a PNG file
$f = fopen($file,'rb');
@@ -1240,7 +1261,7 @@ function _parsepng($file) return $info;
}
-function _parsepngstream($f, $file)
+protected function _parsepngstream($f, $file)
{
// Check signature
if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
@@ -1358,6 +1379,7 @@ function _parsepngstream($f, $file) unset($data);
$data = gzcompress($color);
$info['smask'] = gzcompress($alpha);
+ $this->WithAlpha = true;
if($this->PDFVersion<'1.4')
$this->PDFVersion = '1.4';
}
@@ -1365,7 +1387,7 @@ function _parsepngstream($f, $file) return $info;
}
-function _readstream($f, $n)
+protected function _readstream($f, $n)
{
// Read n bytes from stream
$res = '';
@@ -1382,14 +1404,14 @@ function _readstream($f, $n) return $res;
}
-function _readint($f)
+protected function _readint($f)
{
// Read a 4-byte integer from stream
$a = unpack('Ni',$this->_readstream($f,4));
return $a['i'];
}
-function _parsegif($file)
+protected function _parsegif($file)
{
// Extract info from a GIF file (via PNG conversion)
if(!function_exists('imagepng'))
@@ -1400,141 +1422,149 @@ function _parsegif($file) if(!$im)
$this->Error('Missing or incorrect image file: '.$file);
imageinterlace($im,0);
- $f = @fopen('php://temp','rb+');
- if($f)
- {
- // Perform conversion in memory
- ob_start();
- imagepng($im);
- $data = ob_get_clean();
- imagedestroy($im);
- fwrite($f,$data);
- rewind($f);
- $info = $this->_parsepngstream($f,$file);
- fclose($f);
- }
- else
- {
- // Use temporary file
- $tmp = tempnam('.','gif');
- if(!$tmp)
- $this->Error('Unable to create a temporary file');
- if(!imagepng($im,$tmp))
- $this->Error('Error while saving to temporary file');
- imagedestroy($im);
- $info = $this->_parsepng($tmp);
- unlink($tmp);
- }
+ ob_start();
+ imagepng($im);
+ $data = ob_get_clean();
+ imagedestroy($im);
+ $f = fopen('php://temp','rb+');
+ if(!$f)
+ $this->Error('Unable to create memory stream');
+ fwrite($f,$data);
+ rewind($f);
+ $info = $this->_parsepngstream($f,$file);
+ fclose($f);
return $info;
}
-function _newobj()
+protected function _out($s)
{
- // Begin a new object
- $this->n++;
- $this->offsets[$this->n] = strlen($this->buffer);
- $this->_out($this->n.' 0 obj');
+ // Add a line to the document
+ 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==3)
+ $this->Error('The document is closed');
}
-function _putstream($s)
+protected function _put($s)
{
- $this->_out('stream');
- $this->_out($s);
- $this->_out('endstream');
+ $this->buffer .= $s."\n";
}
-function _out($s)
+protected function _getoffset()
{
- // Add a line to the document
- if($this->state==2)
- $this->pages[$this->page] .= $s."\n";
- else
- $this->buffer .= $s."\n";
+ return strlen($this->buffer);
}
-function _putpages()
+protected function _newobj($n=null)
{
- $nb = $this->page;
- if(!empty($this->AliasNbPages))
- {
- // Replace number of pages
- for($n=1;$n<=$nb;$n++)
- $this->pages[$n] = str_replace($this->AliasNbPages,$nb,$this->pages[$n]);
- }
- if($this->DefOrientation=='P')
+ // Begin a new object
+ if($n===null)
+ $n = ++$this->n;
+ $this->offsets[$n] = $this->_getoffset();
+ $this->_put($n.' 0 obj');
+}
+
+protected function _putstream($data)
+{
+ $this->_put('stream');
+ $this->_put($data);
+ $this->_put('endstream');
+}
+
+protected function _putstreamobject($data)
+{
+ if($this->compress)
{
- $wPt = $this->DefPageSize[0]*$this->k;
- $hPt = $this->DefPageSize[1]*$this->k;
+ $entries = '/Filter /FlateDecode ';
+ $data = gzcompress($data);
}
else
+ $entries = '';
+ $entries .= '/Length '.strlen($data);
+ $this->_newobj();
+ $this->_put('<<'.$entries.'>>');
+ $this->_putstream($data);
+ $this->_put('endobj');
+}
+
+protected function _putpage($n)
+{
+ $this->_newobj();
+ $this->_put('<</Type /Page');
+ $this->_put('/Parent 1 0 R');
+ if(isset($this->PageInfo[$n]['size']))
+ $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1]));
+ if(isset($this->PageInfo[$n]['rotation']))
+ $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
+ $this->_put('/Resources 2 0 R');
+ if(isset($this->PageLinks[$n]))
{
- $wPt = $this->DefPageSize[1]*$this->k;
- $hPt = $this->DefPageSize[0]*$this->k;
- }
- $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
- for($n=1;$n<=$nb;$n++)
- {
- // Page
- $this->_newobj();
- $this->_out('<</Type /Page');
- $this->_out('/Parent 1 0 R');
- if(isset($this->PageSizes[$n]))
- $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1]));
- $this->_out('/Resources 2 0 R');
- if(isset($this->PageLinks[$n]))
+ // Links
+ $annots = '/Annots [';
+ foreach($this->PageLinks[$n] as $pl)
{
- // Links
- $annots = '/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
{
- $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]).'>>>>';
+ $l = $this->links[$pl[4]];
+ if(isset($this->PageInfo[$l[0]]['size']))
+ $h = $this->PageInfo[$l[0]]['size'][1];
else
- {
- $l = $this->links[$pl[4]];
- $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
- $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k);
- }
+ $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->_out($annots.']');
}
- if($this->PDFVersion>'1.3')
- $this->_out('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
- $this->_out('/Contents '.($this->n+1).' 0 R>>');
- $this->_out('endobj');
- // Page content
- $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
- $this->_newobj();
- $this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
- $this->_putstream($p);
- $this->_out('endobj');
+ $this->_put($annots.']');
}
- // Pages root
- $this->offsets[1] = strlen($this->buffer);
- $this->_out('1 0 obj');
- $this->_out('<</Type /Pages');
- $kids = '/Kids [';
- for($i=0;$i<$nb;$i++)
- $kids .= (3+2*$i).' 0 R ';
- $this->_out($kids.']');
- $this->_out('/Count '.$nb);
- $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt));
- $this->_out('>>');
- $this->_out('endobj');
+ if($this->WithAlpha)
+ $this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
+ $this->_put('/Contents '.($this->n+1).' 0 R>>');
+ $this->_put('endobj');
+ // Page content
+ if(!empty($this->AliasNbPages))
+ $this->pages[$n] = str_replace($this->AliasNbPages,$this->page,$this->pages[$n]);
+ $this->_putstreamobject($this->pages[$n]);
}
-function _putfonts()
+protected function _putpages()
{
- $nf = $this->n;
- foreach($this->diffs as $diff)
+ $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);
+ // 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.']');
+ $this->_put('/Count '.$nb);
+ if($this->DefOrientation=='P')
{
- // Encodings
- $this->_newobj();
- $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
- $this->_out('endobj');
+ $w = $this->DefPageSize[0];
+ $h = $this->DefPageSize[1];
}
+ else
+ {
+ $w = $this->DefPageSize[1];
+ $h = $this->DefPageSize[0];
+ }
+ $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$w*$this->k,$h*$this->k));
+ $this->_put('>>');
+ $this->_put('endobj');
+}
+
+protected function _putfonts()
+{
foreach($this->FontFiles as $file=>$info)
{
// Font file embedding
@@ -1546,58 +1576,89 @@ function _putfonts() $compressed = (substr($file,-2)=='.z');
if(!$compressed && isset($info['length2']))
$font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']);
- $this->_out('<</Length '.strlen($font));
+ $this->_put('<</Length '.strlen($font));
if($compressed)
- $this->_out('/Filter /FlateDecode');
- $this->_out('/Length1 '.$info['length1']);
+ $this->_put('/Filter /FlateDecode');
+ $this->_put('/Length1 '.$info['length1']);
if(isset($info['length2']))
- $this->_out('/Length2 '.$info['length2'].' /Length3 0');
- $this->_out('>>');
+ $this->_put('/Length2 '.$info['length2'].' /Length3 0');
+ $this->_put('>>');
$this->_putstream($font);
- $this->_out('endobj');
+ $this->_put('endobj');
}
foreach($this->fonts as $k=>$font)
{
- // Font objects
+ // Encoding
+ if(isset($font['diff']))
+ {
+ if(!isset($this->encodings[$font['enc']]))
+ {
+ $this->_newobj();
+ $this->_put('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$font['diff'].']>>');
+ $this->_put('endobj');
+ $this->encodings[$font['enc']] = $this->n;
+ }
+ }
+ // ToUnicode CMap
+ if(isset($font['uv']))
+ {
+ if(isset($font['enc']))
+ $cmapkey = $font['enc'];
+ else
+ $cmapkey = $font['name'];
+ if(!isset($this->cmaps[$cmapkey]))
+ {
+ $cmap = $this->_tounicodecmap($font['uv']);
+ $this->_putstreamobject($cmap);
+ $this->cmaps[$cmapkey] = $this->n;
+ }
+ }
+ // Font object
$this->fonts[$k]['n'] = $this->n+1;
$type = $font['type'];
$name = $font['name'];
+ if($font['subsetted'])
+ $name = 'AAAAAA+'.$name;
if($type=='Core')
{
// Core font
$this->_newobj();
- $this->_out('<</Type /Font');
- $this->_out('/BaseFont /'.$name);
- $this->_out('/Subtype /Type1');
+ $this->_put('<</Type /Font');
+ $this->_put('/BaseFont /'.$name);
+ $this->_put('/Subtype /Type1');
if($name!='Symbol' && $name!='ZapfDingbats')
- $this->_out('/Encoding /WinAnsiEncoding');
- $this->_out('>>');
- $this->_out('endobj');
+ $this->_put('/Encoding /WinAnsiEncoding');
+ if(isset($font['uv']))
+ $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
+ $this->_put('>>');
+ $this->_put('endobj');
}
elseif($type=='Type1' || $type=='TrueType')
{
// Additional Type1 or TrueType/OpenType font
$this->_newobj();
- $this->_out('<</Type /Font');
- $this->_out('/BaseFont /'.$name);
- $this->_out('/Subtype /'.$type);
- $this->_out('/FirstChar 32 /LastChar 255');
- $this->_out('/Widths '.($this->n+1).' 0 R');
- $this->_out('/FontDescriptor '.($this->n+2).' 0 R');
- if(isset($font['diffn']))
- $this->_out('/Encoding '.($nf+$font['diffn']).' 0 R');
+ $this->_put('<</Type /Font');
+ $this->_put('/BaseFont /'.$name);
+ $this->_put('/Subtype /'.$type);
+ $this->_put('/FirstChar 32 /LastChar 255');
+ $this->_put('/Widths '.($this->n+1).' 0 R');
+ $this->_put('/FontDescriptor '.($this->n+2).' 0 R');
+ if(isset($font['diff']))
+ $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R');
else
- $this->_out('/Encoding /WinAnsiEncoding');
- $this->_out('>>');
- $this->_out('endobj');
+ $this->_put('/Encoding /WinAnsiEncoding');
+ if(isset($font['uv']))
+ $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
+ $this->_put('>>');
+ $this->_put('endobj');
// Widths
$this->_newobj();
$cw = &$font['cw'];
$s = '[';
for($i=32;$i<=255;$i++)
$s .= $cw[chr($i)].' ';
- $this->_out($s.']');
- $this->_out('endobj');
+ $this->_put($s.']');
+ $this->_put('endobj');
// Descriptor
$this->_newobj();
$s = '<</Type /FontDescriptor /FontName /'.$name;
@@ -1605,8 +1666,8 @@ function _putfonts() $s .= ' /'.$k.' '.$v;
if(!empty($font['file']))
$s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R';
- $this->_out($s.'>>');
- $this->_out('endobj');
+ $this->_put($s.'>>');
+ $this->_put('endobj');
}
else
{
@@ -1619,7 +1680,58 @@ function _putfonts() }
}
-function _putimages()
+protected function _tounicodecmap($uv)
+{
+ $ranges = '';
+ $nbr = 0;
+ $chars = '';
+ $nbc = 0;
+ foreach($uv as $c=>$v)
+ {
+ if(is_array($v))
+ {
+ $ranges .= sprintf("<%02X> <%02X> <%04X>\n",$c,$c+$v[1]-1,$v[0]);
+ $nbr++;
+ }
+ else
+ {
+ $chars .= sprintf("<%02X> <%04X>\n",$c,$v);
+ $nbc++;
+ }
+ }
+ $s = "/CIDInit /ProcSet findresource begin\n";
+ $s .= "12 dict begin\n";
+ $s .= "begincmap\n";
+ $s .= "/CIDSystemInfo\n";
+ $s .= "<</Registry (Adobe)\n";
+ $s .= "/Ordering (UCS)\n";
+ $s .= "/Supplement 0\n";
+ $s .= ">> def\n";
+ $s .= "/CMapName /Adobe-Identity-UCS def\n";
+ $s .= "/CMapType 2 def\n";
+ $s .= "1 begincodespacerange\n";
+ $s .= "<00> <FF>\n";
+ $s .= "endcodespacerange\n";
+ if($nbr>0)
+ {
+ $s .= "$nbr beginbfrange\n";
+ $s .= $ranges;
+ $s .= "endbfrange\n";
+ }
+ if($nbc>0)
+ {
+ $s .= "$nbc beginbfchar\n";
+ $s .= $chars;
+ $s .= "endbfchar\n";
+ }
+ $s .= "endcmap\n";
+ $s .= "CMapName currentdict /CMap defineresource pop\n";
+ $s .= "end\n";
+ $s .= "end";
+ return $s;
+}
+
+protected function _putimages()
{
foreach(array_keys($this->images) as $file)
{
@@ -1629,39 +1741,39 @@ function _putimages() }
}
-function _putimage(&$info)
+protected function _putimage(&$info)
{
$this->_newobj();
$info['n'] = $this->n;
- $this->_out('<</Type /XObject');
- $this->_out('/Subtype /Image');
- $this->_out('/Width '.$info['w']);
- $this->_out('/Height '.$info['h']);
+ $this->_put('<</Type /XObject');
+ $this->_put('/Subtype /Image');
+ $this->_put('/Width '.$info['w']);
+ $this->_put('/Height '.$info['h']);
if($info['cs']=='Indexed')
- $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
+ $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
else
{
- $this->_out('/ColorSpace /'.$info['cs']);
+ $this->_put('/ColorSpace /'.$info['cs']);
if($info['cs']=='DeviceCMYK')
- $this->_out('/Decode [1 0 1 0 1 0 1 0]');
+ $this->_put('/Decode [1 0 1 0 1 0 1 0]');
}
- $this->_out('/BitsPerComponent '.$info['bpc']);
+ $this->_put('/BitsPerComponent '.$info['bpc']);
if(isset($info['f']))
- $this->_out('/Filter /'.$info['f']);
+ $this->_put('/Filter /'.$info['f']);
if(isset($info['dp']))
- $this->_out('/DecodeParms <<'.$info['dp'].'>>');
+ $this->_put('/DecodeParms <<'.$info['dp'].'>>');
if(isset($info['trns']) && is_array($info['trns']))
{
$trns = '';
for($i=0;$i<count($info['trns']);$i++)
$trns .= $info['trns'][$i].' '.$info['trns'][$i].' ';
- $this->_out('/Mask ['.$trns.']');
+ $this->_put('/Mask ['.$trns.']');
}
if(isset($info['smask']))
- $this->_out('/SMask '.($this->n+1).' 0 R');
- $this->_out('/Length '.strlen($info['data']).'>>');
+ $this->_put('/SMask '.($this->n+1).' 0 R');
+ $this->_put('/Length '.strlen($info['data']).'>>');
$this->_putstream($info['data']);
- $this->_out('endobj');
+ $this->_put('endobj');
// Soft mask
if(isset($info['smask']))
{
@@ -1671,137 +1783,113 @@ function _putimage(&$info) }
// Palette
if($info['cs']=='Indexed')
- {
- $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
- $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal'];
- $this->_newobj();
- $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
- $this->_putstream($pal);
- $this->_out('endobj');
- }
+ $this->_putstreamobject($info['pal']);
}
-function _putxobjectdict()
+protected function _putxobjectdict()
{
foreach($this->images as $image)
- $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
+ $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R');
}
-function _putresourcedict()
+protected function _putresourcedict()
{
- $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
- $this->_out('/Font <<');
+ $this->_put('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
+ $this->_put('/Font <<');
foreach($this->fonts as $font)
- $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
- $this->_out('>>');
- $this->_out('/XObject <<');
+ $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R');
+ $this->_put('>>');
+ $this->_put('/XObject <<');
$this->_putxobjectdict();
- $this->_out('>>');
+ $this->_put('>>');
}
-function _putresources()
+protected function _putresources()
{
$this->_putfonts();
$this->_putimages();
// Resource dictionary
- $this->offsets[2] = strlen($this->buffer);
- $this->_out('2 0 obj');
- $this->_out('<<');
+ $this->_newobj(2);
+ $this->_put('<<');
$this->_putresourcedict();
- $this->_out('>>');
- $this->_out('endobj');
+ $this->_put('>>');
+ $this->_put('endobj');
}
-function _putinfo()
+protected function _putinfo()
{
- $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
- if(!empty($this->title))
- $this->_out('/Title '.$this->_textstring($this->title));
- if(!empty($this->subject))
- $this->_out('/Subject '.$this->_textstring($this->subject));
- if(!empty($this->author))
- $this->_out('/Author '.$this->_textstring($this->author));
- if(!empty($this->keywords))
- $this->_out('/Keywords '.$this->_textstring($this->keywords));
- if(!empty($this->creator))
- $this->_out('/Creator '.$this->_textstring($this->creator));
- $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis')));
+ $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION;
+ $this->metadata['CreationDate'] = 'D:'.@date('YmdHis');
+ foreach($this->metadata as $key=>$value)
+ $this->_put('/'.$key.' '.$this->_textstring($value));
}
-function _putcatalog()
+protected function _putcatalog()
{
- $this->_out('/Type /Catalog');
- $this->_out('/Pages 1 0 R');
+ $n = $this->PageInfo[1]['n'];
+ $this->_put('/Type /Catalog');
+ $this->_put('/Pages 1 0 R');
if($this->ZoomMode=='fullpage')
- $this->_out('/OpenAction [3 0 R /Fit]');
+ $this->_put('/OpenAction ['.$n.' 0 R /Fit]');
elseif($this->ZoomMode=='fullwidth')
- $this->_out('/OpenAction [3 0 R /FitH null]');
+ $this->_put('/OpenAction ['.$n.' 0 R /FitH null]');
elseif($this->ZoomMode=='real')
- $this->_out('/OpenAction [3 0 R /XYZ null null 1]');
+ $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
elseif(!is_string($this->ZoomMode))
- $this->_out('/OpenAction [3 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
+ $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
if($this->LayoutMode=='single')
- $this->_out('/PageLayout /SinglePage');
+ $this->_put('/PageLayout /SinglePage');
elseif($this->LayoutMode=='continuous')
- $this->_out('/PageLayout /OneColumn');
+ $this->_put('/PageLayout /OneColumn');
elseif($this->LayoutMode=='two')
- $this->_out('/PageLayout /TwoColumnLeft');
+ $this->_put('/PageLayout /TwoColumnLeft');
}
-function _putheader()
+protected function _putheader()
{
- $this->_out('%PDF-'.$this->PDFVersion);
+ $this->_put('%PDF-'.$this->PDFVersion);
}
-function _puttrailer()
+protected function _puttrailer()
{
- $this->_out('/Size '.($this->n+1));
- $this->_out('/Root '.$this->n.' 0 R');
- $this->_out('/Info '.($this->n-1).' 0 R');
+ $this->_put('/Size '.($this->n+1));
+ $this->_put('/Root '.$this->n.' 0 R');
+ $this->_put('/Info '.($this->n-1).' 0 R');
}
-function _enddoc()
+protected function _enddoc()
{
$this->_putheader();
$this->_putpages();
$this->_putresources();
// Info
$this->_newobj();
- $this->_out('<<');
+ $this->_put('<<');
$this->_putinfo();
- $this->_out('>>');
- $this->_out('endobj');
+ $this->_put('>>');
+ $this->_put('endobj');
// Catalog
$this->_newobj();
- $this->_out('<<');
+ $this->_put('<<');
$this->_putcatalog();
- $this->_out('>>');
- $this->_out('endobj');
+ $this->_put('>>');
+ $this->_put('endobj');
// Cross-ref
- $o = strlen($this->buffer);
- $this->_out('xref');
- $this->_out('0 '.($this->n+1));
- $this->_out('0000000000 65535 f ');
+ $offset = $this->_getoffset();
+ $this->_put('xref');
+ $this->_put('0 '.($this->n+1));
+ $this->_put('0000000000 65535 f ');
for($i=1;$i<=$this->n;$i++)
- $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
+ $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i]));
// Trailer
- $this->_out('trailer');
- $this->_out('<<');
+ $this->_put('trailer');
+ $this->_put('<<');
$this->_puttrailer();
- $this->_out('>>');
- $this->_out('startxref');
- $this->_out($o);
- $this->_out('%%EOF');
+ $this->_put('>>');
+ $this->_put('startxref');
+ $this->_put($offset);
+ $this->_put('%%EOF');
$this->state = 3;
}
-// End of class
}
-
-// Handle special IE contype request
-if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype')
-{
- header('Content-Type: application/pdf');
- exit;
-}
-
?>
diff --git a/pdf/fpdf/install.txt b/pdf/fpdf/install.txt index 73ded64..73ded64 100755..100644 --- a/pdf/fpdf/install.txt +++ b/pdf/fpdf/install.txt diff --git a/pdf/fpdf/license.txt b/pdf/fpdf/license.txt index fd811c6..fd811c6 100755..100644 --- a/pdf/fpdf/license.txt +++ b/pdf/fpdf/license.txt diff --git a/pdf/fpdf/makefont/cp1250.map b/pdf/fpdf/makefont/cp1250.map index ec110af..ec110af 100755..100644 --- a/pdf/fpdf/makefont/cp1250.map +++ b/pdf/fpdf/makefont/cp1250.map diff --git a/pdf/fpdf/makefont/cp1251.map b/pdf/fpdf/makefont/cp1251.map index de6a198..de6a198 100755..100644 --- a/pdf/fpdf/makefont/cp1251.map +++ b/pdf/fpdf/makefont/cp1251.map diff --git a/pdf/fpdf/makefont/cp1252.map b/pdf/fpdf/makefont/cp1252.map index dd490e5..dd490e5 100755..100644 --- a/pdf/fpdf/makefont/cp1252.map +++ b/pdf/fpdf/makefont/cp1252.map diff --git a/pdf/fpdf/makefont/cp1253.map b/pdf/fpdf/makefont/cp1253.map index 4bd826f..4bd826f 100755..100644 --- a/pdf/fpdf/makefont/cp1253.map +++ b/pdf/fpdf/makefont/cp1253.map diff --git a/pdf/fpdf/makefont/cp1254.map b/pdf/fpdf/makefont/cp1254.map index 829473b..829473b 100755..100644 --- a/pdf/fpdf/makefont/cp1254.map +++ b/pdf/fpdf/makefont/cp1254.map diff --git a/pdf/fpdf/makefont/cp1255.map b/pdf/fpdf/makefont/cp1255.map index 079e10c..079e10c 100755..100644 --- a/pdf/fpdf/makefont/cp1255.map +++ b/pdf/fpdf/makefont/cp1255.map diff --git a/pdf/fpdf/makefont/cp1257.map b/pdf/fpdf/makefont/cp1257.map index 2f2ecfa..2f2ecfa 100755..100644 --- a/pdf/fpdf/makefont/cp1257.map +++ b/pdf/fpdf/makefont/cp1257.map diff --git a/pdf/fpdf/makefont/cp1258.map b/pdf/fpdf/makefont/cp1258.map index fed915f..fed915f 100755..100644 --- a/pdf/fpdf/makefont/cp1258.map +++ b/pdf/fpdf/makefont/cp1258.map diff --git a/pdf/fpdf/makefont/cp874.map b/pdf/fpdf/makefont/cp874.map index 1006e6b..1006e6b 100755..100644 --- a/pdf/fpdf/makefont/cp874.map +++ b/pdf/fpdf/makefont/cp874.map diff --git a/pdf/fpdf/makefont/iso-8859-1.map b/pdf/fpdf/makefont/iso-8859-1.map index 61740a3..61740a3 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-1.map +++ b/pdf/fpdf/makefont/iso-8859-1.map diff --git a/pdf/fpdf/makefont/iso-8859-11.map b/pdf/fpdf/makefont/iso-8859-11.map index 9168812..9168812 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-11.map +++ b/pdf/fpdf/makefont/iso-8859-11.map diff --git a/pdf/fpdf/makefont/iso-8859-15.map b/pdf/fpdf/makefont/iso-8859-15.map index 6c2b571..6c2b571 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-15.map +++ b/pdf/fpdf/makefont/iso-8859-15.map diff --git a/pdf/fpdf/makefont/iso-8859-16.map b/pdf/fpdf/makefont/iso-8859-16.map index 202c8fe..202c8fe 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-16.map +++ b/pdf/fpdf/makefont/iso-8859-16.map diff --git a/pdf/fpdf/makefont/iso-8859-2.map b/pdf/fpdf/makefont/iso-8859-2.map index 65ae09f..65ae09f 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-2.map +++ b/pdf/fpdf/makefont/iso-8859-2.map diff --git a/pdf/fpdf/makefont/iso-8859-4.map b/pdf/fpdf/makefont/iso-8859-4.map index a7d87bf..a7d87bf 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-4.map +++ b/pdf/fpdf/makefont/iso-8859-4.map diff --git a/pdf/fpdf/makefont/iso-8859-5.map b/pdf/fpdf/makefont/iso-8859-5.map index f9cd4ed..f9cd4ed 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-5.map +++ b/pdf/fpdf/makefont/iso-8859-5.map diff --git a/pdf/fpdf/makefont/iso-8859-7.map b/pdf/fpdf/makefont/iso-8859-7.map index e163796..e163796 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-7.map +++ b/pdf/fpdf/makefont/iso-8859-7.map diff --git a/pdf/fpdf/makefont/iso-8859-9.map b/pdf/fpdf/makefont/iso-8859-9.map index 48c123a..48c123a 100755..100644 --- a/pdf/fpdf/makefont/iso-8859-9.map +++ b/pdf/fpdf/makefont/iso-8859-9.map diff --git a/pdf/fpdf/makefont/koi8-r.map b/pdf/fpdf/makefont/koi8-r.map index 6ad5d05..6ad5d05 100755..100644 --- a/pdf/fpdf/makefont/koi8-r.map +++ b/pdf/fpdf/makefont/koi8-r.map diff --git a/pdf/fpdf/makefont/koi8-u.map b/pdf/fpdf/makefont/koi8-u.map index 40a7e4f..40a7e4f 100755..100644 --- a/pdf/fpdf/makefont/koi8-u.map +++ b/pdf/fpdf/makefont/koi8-u.map diff --git a/pdf/fpdf/makefont/makefont.php b/pdf/fpdf/makefont/makefont.php index 78db0aa..fbe8dcf 100755..100644 --- a/pdf/fpdf/makefont/makefont.php +++ b/pdf/fpdf/makefont/makefont.php @@ -2,8 +2,8 @@ /*******************************************************************************
* Utility to generate font definition files *
* *
-* Version: 1.2 *
-* Date: 2011-06-18 *
+* Version: 1.31 *
+* Date: 2019-12-07 *
* Author: Olivier PLATHEY *
*******************************************************************************/
@@ -59,21 +59,40 @@ function LoadMap($enc) return $map;
}
-function GetInfoFromTrueType($file, $embed, $map)
+function GetInfoFromTrueType($file, $embed, $subset, $map)
{
- // Return informations from a TrueType font
- $ttf = new TTFParser();
- $ttf->Parse($file);
+ // Return information from a TrueType font
+ try
+ {
+ $ttf = new TTFParser($file);
+ $ttf->Parse();
+ }
+ catch(Exception $e)
+ {
+ Error($e->getMessage());
+ }
if($embed)
{
- if(!$ttf->Embeddable)
+ if(!$ttf->embeddable)
Error('Font license does not allow embedding');
- $info['Data'] = file_get_contents($file);
- $info['OriginalSize'] = filesize($file);
+ if($subset)
+ {
+ $chars = array();
+ foreach($map as $v)
+ {
+ if($v['name']!='.notdef')
+ $chars[] = $v['uv'];
+ }
+ $ttf->Subset($chars);
+ $info['Data'] = $ttf->Build();
+ }
+ else
+ $info['Data'] = file_get_contents($file);
+ $info['OriginalSize'] = strlen($info['Data']);
}
$k = 1000/$ttf->unitsPerEm;
$info['FontName'] = $ttf->postScriptName;
- $info['Bold'] = $ttf->Bold;
+ $info['Bold'] = $ttf->bold;
$info['ItalicAngle'] = $ttf->italicAngle;
$info['IsFixedPitch'] = $ttf->isFixedPitch;
$info['Ascender'] = round($k*$ttf->typoAscender);
@@ -82,20 +101,20 @@ function GetInfoFromTrueType($file, $embed, $map) $info['UnderlinePosition'] = round($k*$ttf->underlinePosition);
$info['FontBBox'] = array(round($k*$ttf->xMin), round($k*$ttf->yMin), round($k*$ttf->xMax), round($k*$ttf->yMax));
$info['CapHeight'] = round($k*$ttf->capHeight);
- $info['MissingWidth'] = round($k*$ttf->widths[0]);
+ $info['MissingWidth'] = round($k*$ttf->glyphs[0]['w']);
$widths = array_fill(0, 256, $info['MissingWidth']);
- for($c=0;$c<=255;$c++)
+ foreach($map as $c=>$v)
{
- if($map[$c]['name']!='.notdef')
+ if($v['name']!='.notdef')
{
- $uv = $map[$c]['uv'];
- if(isset($ttf->chars[$uv]))
+ if(isset($ttf->chars[$v['uv']]))
{
- $w = $ttf->widths[$ttf->chars[$uv]];
+ $id = $ttf->chars[$v['uv']];
+ $w = $ttf->glyphs[$id]['w'];
$widths[$c] = round($k*$w);
}
else
- Warning('Character '.$map[$c]['name'].' is missing');
+ Warning('Character '.$v['name'].' is missing');
}
}
$info['Widths'] = $widths;
@@ -104,7 +123,7 @@ function GetInfoFromTrueType($file, $embed, $map) function GetInfoFromType1($file, $embed, $map)
{
- // Return informations from a Type1 font
+ // Return information from a Type1 font
if($embed)
{
$f = fopen($file, 'rb');
@@ -172,21 +191,24 @@ function GetInfoFromType1($file, $embed, $map) if(!isset($info['FontName']))
Error('FontName missing in AFM file');
+ if(!isset($info['Ascender']))
+ $info['Ascender'] = $info['FontBBox'][3];
+ if(!isset($info['Descender']))
+ $info['Descender'] = $info['FontBBox'][1];
$info['Bold'] = isset($info['Weight']) && preg_match('/bold|black/i', $info['Weight']);
if(isset($cw['.notdef']))
$info['MissingWidth'] = $cw['.notdef'];
else
$info['MissingWidth'] = 0;
$widths = array_fill(0, 256, $info['MissingWidth']);
- for($c=0;$c<=255;$c++)
+ foreach($map as $c=>$v)
{
- $name = $map[$c]['name'];
- if($name!='.notdef')
+ if($v['name']!='.notdef')
{
- if(isset($cw[$name]))
- $widths[$c] = $cw[$name];
+ if(isset($cw[$v['name']]))
+ $widths[$c] = $cw[$v['name']];
else
- Warning('Character '.$name.' is missing');
+ Warning('Character '.$v['name'].' is missing');
}
}
$info['Widths'] = $widths;
@@ -272,16 +294,61 @@ function MakeFontEncoding($map) return rtrim($s);
}
+function MakeUnicodeArray($map)
+{
+ // Build mapping to Unicode values
+ $ranges = array();
+ foreach($map as $c=>$v)
+ {
+ $uv = $v['uv'];
+ if($uv!=-1)
+ {
+ if(isset($range))
+ {
+ if($c==$range[1]+1 && $uv==$range[3]+1)
+ {
+ $range[1]++;
+ $range[3]++;
+ }
+ else
+ {
+ $ranges[] = $range;
+ $range = array($c, $c, $uv, $uv);
+ }
+ }
+ else
+ $range = array($c, $c, $uv, $uv);
+ }
+ }
+ $ranges[] = $range;
+
+ foreach($ranges as $range)
+ {
+ if(isset($s))
+ $s .= ',';
+ else
+ $s = 'array(';
+ $s .= $range[0].'=>';
+ $nb = $range[1]-$range[0]+1;
+ if($nb>1)
+ $s .= 'array('.$range[2].','.$nb.')';
+ else
+ $s .= $range[2];
+ }
+ $s .= ')';
+ return $s;
+}
+
function SaveToFile($file, $s, $mode)
{
$f = fopen($file, 'w'.$mode);
if(!$f)
Error('Can\'t write to file '.$file);
- fwrite($f, $s, strlen($s));
+ fwrite($f, $s);
fclose($f);
}
-function MakeDefinitionFile($file, $type, $enc, $embed, $map, $info)
+function MakeDefinitionFile($file, $type, $enc, $embed, $subset, $map, $info)
{
$s = "<?php\n";
$s .= '$type = \''.$type."';\n";
@@ -294,6 +361,7 @@ function MakeDefinitionFile($file, $type, $enc, $embed, $map, $info) $diff = MakeFontEncoding($map);
if($diff)
$s .= '$diff = \''.$diff."';\n";
+ $s .= '$uv = '.MakeUnicodeArray($map).";\n";
if($embed)
{
$s .= '$file = \''.$info['File']."';\n";
@@ -303,19 +371,19 @@ function MakeDefinitionFile($file, $type, $enc, $embed, $map, $info) $s .= '$size2 = '.$info['Size2'].";\n";
}
else
+ {
$s .= '$originalsize = '.$info['OriginalSize'].";\n";
+ if($subset)
+ $s .= "\$subsetted = true;\n";
+ }
}
$s .= "?>\n";
SaveToFile($file, $s, 't');
}
-function MakeFont($fontfile, $enc='cp1252', $embed=true)
+function MakeFont($fontfile, $enc='cp1252', $embed=true, $subset=true)
{
// Generate a font definition file
- if(get_magic_quotes_runtime())
- @set_magic_quotes_runtime(0);
- ini_set('auto_detect_line_endings', '1');
-
if(!file_exists($fontfile))
Error('Font file not found: '.$fontfile);
$ext = strtolower(substr($fontfile,-3));
@@ -329,7 +397,7 @@ function MakeFont($fontfile, $enc='cp1252', $embed=true) $map = LoadMap($enc);
if($type=='TrueType')
- $info = GetInfoFromTrueType($fontfile, $embed, $map);
+ $info = GetInfoFromTrueType($fontfile, $embed, $subset, $map);
else
$info = GetInfoFromType1($fontfile, $embed, $map);
@@ -346,19 +414,21 @@ function MakeFont($fontfile, $enc='cp1252', $embed=true) else
{
$info['File'] = basename($fontfile);
+ $subset = false;
Notice('Font file could not be compressed (zlib extension not available)');
}
}
- MakeDefinitionFile($basename.'.php', $type, $enc, $embed, $map, $info);
+ MakeDefinitionFile($basename.'.php', $type, $enc, $embed, $subset, $map, $info);
Message('Font definition file generated: '.$basename.'.php');
}
if(PHP_SAPI=='cli')
{
// Command-line interface
+ ini_set('log_errors', '0');
if($argc==1)
- die("Usage: php makefont.php fontfile [enc] [embed]\n");
+ die("Usage: php makefont.php fontfile [encoding] [embed] [subset]\n");
$fontfile = $argv[1];
if($argc>=3)
$enc = $argv[2];
@@ -368,6 +438,10 @@ if(PHP_SAPI=='cli') $embed = ($argv[3]=='true' || $argv[3]=='1');
else
$embed = true;
- MakeFont($fontfile, $enc, $embed);
+ if($argc>=5)
+ $subset = ($argv[4]=='true' || $argv[4]=='1');
+ else
+ $subset = true;
+ MakeFont($fontfile, $enc, $embed, $subset);
}
?>
diff --git a/pdf/fpdf/makefont/ttfparser.php b/pdf/fpdf/makefont/ttfparser.php index 602a543..e6ba321 100755..100644 --- a/pdf/fpdf/makefont/ttfparser.php +++ b/pdf/fpdf/makefont/ttfparser.php @@ -1,39 +1,67 @@ <?php
/*******************************************************************************
-* Utility to parse TTF font files *
+* Class to parse and subset TrueType fonts *
* *
-* Version: 1.0 *
-* Date: 2011-06-18 *
+* Version: 1.1 *
+* Date: 2015-11-29 *
* Author: Olivier PLATHEY *
*******************************************************************************/
class TTFParser
{
- var $f;
- var $tables;
- var $unitsPerEm;
- var $xMin, $yMin, $xMax, $yMax;
- var $numberOfHMetrics;
- var $numGlyphs;
- var $widths;
- var $chars;
- var $postScriptName;
- var $Embeddable;
- var $Bold;
- var $typoAscender;
- var $typoDescender;
- var $capHeight;
- var $italicAngle;
- var $underlinePosition;
- var $underlineThickness;
- var $isFixedPitch;
-
- function Parse($file)
+ protected $f;
+ protected $tables;
+ protected $numberOfHMetrics;
+ protected $numGlyphs;
+ protected $glyphNames;
+ protected $indexToLocFormat;
+ protected $subsettedChars;
+ protected $subsettedGlyphs;
+ public $chars;
+ public $glyphs;
+ public $unitsPerEm;
+ public $xMin, $yMin, $xMax, $yMax;
+ public $postScriptName;
+ public $embeddable;
+ public $bold;
+ public $typoAscender;
+ public $typoDescender;
+ public $capHeight;
+ public $italicAngle;
+ public $underlinePosition;
+ public $underlineThickness;
+ public $isFixedPitch;
+
+ function __construct($file)
{
$this->f = fopen($file, 'rb');
if(!$this->f)
$this->Error('Can\'t open file: '.$file);
+ }
+
+ function __destruct()
+ {
+ if(is_resource($this->f))
+ fclose($this->f);
+ }
+
+ function Parse()
+ {
+ $this->ParseOffsetTable();
+ $this->ParseHead();
+ $this->ParseHhea();
+ $this->ParseMaxp();
+ $this->ParseHmtx();
+ $this->ParseLoca();
+ $this->ParseGlyf();
+ $this->ParseCmap();
+ $this->ParseName();
+ $this->ParseOS2();
+ $this->ParsePost();
+ }
+ function ParseOffsetTable()
+ {
$version = $this->Read(4);
if($version=='OTTO')
$this->Error('OpenType fonts based on PostScript outlines are not supported');
@@ -45,23 +73,12 @@ class TTFParser for($i=0;$i<$numTables;$i++)
{
$tag = $this->Read(4);
- $this->Skip(4); // checkSum
+ $checkSum = $this->Read(4);
$offset = $this->ReadULong();
- $this->Skip(4); // length
- $this->tables[$tag] = $offset;
+ $length = $this->ReadULong(4);
+ $this->tables[$tag] = array('offset'=>$offset, 'length'=>$length, 'checkSum'=>$checkSum);
}
-
- $this->ParseHead();
- $this->ParseHhea();
- $this->ParseMaxp();
- $this->ParseHmtx();
- $this->ParseCmap();
- $this->ParseName();
- $this->ParseOS2();
- $this->ParsePost();
-
- fclose($this->f);
- }
+ }
function ParseHead()
{
@@ -77,6 +94,8 @@ class TTFParser $this->yMin = $this->ReadShort();
$this->xMax = $this->ReadShort();
$this->yMax = $this->ReadShort();
+ $this->Skip(3*2); // macStyle, lowestRecPPEM, fontDirectionHint
+ $this->indexToLocFormat = $this->ReadShort();
}
function ParseHhea()
@@ -96,17 +115,79 @@ class TTFParser function ParseHmtx()
{
$this->Seek('hmtx');
- $this->widths = array();
+ $this->glyphs = array();
for($i=0;$i<$this->numberOfHMetrics;$i++)
{
$advanceWidth = $this->ReadUShort();
- $this->Skip(2); // lsb
- $this->widths[$i] = $advanceWidth;
+ $lsb = $this->ReadShort();
+ $this->glyphs[$i] = array('w'=>$advanceWidth, 'lsb'=>$lsb);
}
- if($this->numberOfHMetrics<$this->numGlyphs)
+ for($i=$this->numberOfHMetrics;$i<$this->numGlyphs;$i++)
{
- $lastWidth = $this->widths[$this->numberOfHMetrics-1];
- $this->widths = array_pad($this->widths, $this->numGlyphs, $lastWidth);
+ $lsb = $this->ReadShort();
+ $this->glyphs[$i] = array('w'=>$advanceWidth, 'lsb'=>$lsb);
+ }
+ }
+
+ function ParseLoca()
+ {
+ $this->Seek('loca');
+ $offsets = array();
+ if($this->indexToLocFormat==0)
+ {
+ // Short format
+ for($i=0;$i<=$this->numGlyphs;$i++)
+ $offsets[] = 2*$this->ReadUShort();
+ }
+ else
+ {
+ // Long format
+ for($i=0;$i<=$this->numGlyphs;$i++)
+ $offsets[] = $this->ReadULong();
+ }
+ for($i=0;$i<$this->numGlyphs;$i++)
+ {
+ $this->glyphs[$i]['offset'] = $offsets[$i];
+ $this->glyphs[$i]['length'] = $offsets[$i+1] - $offsets[$i];
+ }
+ }
+
+ function ParseGlyf()
+ {
+ $tableOffset = $this->tables['glyf']['offset'];
+ foreach($this->glyphs as &$glyph)
+ {
+ if($glyph['length']>0)
+ {
+ fseek($this->f, $tableOffset+$glyph['offset'], SEEK_SET);
+ if($this->ReadShort()<0)
+ {
+ // Composite glyph
+ $this->Skip(4*2); // xMin, yMin, xMax, yMax
+ $offset = 5*2;
+ $a = array();
+ do
+ {
+ $flags = $this->ReadUShort();
+ $index = $this->ReadUShort();
+ $a[$offset+2] = $index;
+ if($flags & 1) // ARG_1_AND_2_ARE_WORDS
+ $skip = 2*2;
+ else
+ $skip = 2;
+ if($flags & 8) // WE_HAVE_A_SCALE
+ $skip += 2;
+ elseif($flags & 64) // WE_HAVE_AN_X_AND_Y_SCALE
+ $skip += 2*2;
+ elseif($flags & 128) // WE_HAVE_A_TWO_BY_TWO
+ $skip += 4*2;
+ $this->Skip($skip);
+ $offset += 2*2 + $skip;
+ }
+ while($flags & 32); // MORE_COMPONENTS
+ $glyph['components'] = $a;
+ }
+ }
}
}
@@ -132,7 +213,7 @@ class TTFParser $idDelta = array();
$idRangeOffset = array();
$this->chars = array();
- fseek($this->f, $this->tables['cmap']+$offset31, SEEK_SET);
+ fseek($this->f, $this->tables['cmap']['offset']+$offset31, SEEK_SET);
$format = $this->ReadUShort();
if($format!=4)
$this->Error('Unexpected subtable format: '.$format);
@@ -181,7 +262,7 @@ class TTFParser function ParseName()
{
$this->Seek('name');
- $tableOffset = ftell($this->f);
+ $tableOffset = $this->tables['name']['offset'];
$this->postScriptName = '';
$this->Skip(2); // format
$count = $this->ReadUShort();
@@ -213,10 +294,10 @@ class TTFParser $version = $this->ReadUShort();
$this->Skip(3*2); // xAvgCharWidth, usWeightClass, usWidthClass
$fsType = $this->ReadUShort();
- $this->Embeddable = ($fsType!=2) && ($fsType & 0x200)==0;
+ $this->embeddable = ($fsType!=2) && ($fsType & 0x200)==0;
$this->Skip(11*2+10+4*4+4);
$fsSelection = $this->ReadUShort();
- $this->Bold = ($fsSelection & 32)!=0;
+ $this->bold = ($fsSelection & 32)!=0;
$this->Skip(2*2); // usFirstCharIndex, usLastCharIndex
$this->typoAscender = $this->ReadShort();
$this->typoDescender = $this->ReadShort();
@@ -232,27 +313,362 @@ class TTFParser function ParsePost()
{
$this->Seek('post');
- $this->Skip(4); // version
+ $version = $this->ReadULong();
$this->italicAngle = $this->ReadShort();
$this->Skip(2); // Skip decimal part
$this->underlinePosition = $this->ReadShort();
$this->underlineThickness = $this->ReadShort();
$this->isFixedPitch = ($this->ReadULong()!=0);
+ if($version==0x20000)
+ {
+ // Extract glyph names
+ $this->Skip(4*4); // min/max usage
+ $this->Skip(2); // numberOfGlyphs
+ $glyphNameIndex = array();
+ $names = array();
+ $numNames = 0;
+ for($i=0;$i<$this->numGlyphs;$i++)
+ {
+ $index = $this->ReadUShort();
+ $glyphNameIndex[] = $index;
+ if($index>=258 && $index-257>$numNames)
+ $numNames = $index-257;
+ }
+ for($i=0;$i<$numNames;$i++)
+ {
+ $len = ord($this->Read(1));
+ $names[] = $this->Read($len);
+ }
+ foreach($glyphNameIndex as $i=>$index)
+ {
+ if($index>=258)
+ $this->glyphs[$i]['name'] = $names[$index-258];
+ else
+ $this->glyphs[$i]['name'] = $index;
+ }
+ $this->glyphNames = true;
+ }
+ else
+ $this->glyphNames = false;
}
- function Error($msg)
+ 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)
+ {
+ if(isset($this->chars[$char]))
+ {
+ $this->subsettedChars[] = $char;
+ $this->AddGlyph($this->chars[$char]);
+ }
+ }
+ }
+
+ function AddGlyph($id)
{
- if(PHP_SAPI=='cli')
- die("Error: $msg\n");
+ if(!isset($this->glyphs[$id]['ssid']))
+ {
+ $this->glyphs[$id]['ssid'] = count($this->subsettedGlyphs);
+ $this->subsettedGlyphs[] = $id;
+ if(isset($this->glyphs[$id]['components']))
+ {
+ foreach($this->glyphs[$id]['components'] as $cid)
+ $this->AddGlyph($cid);
+ }
+ }
+ }
+
+ function Build()
+ {
+ $this->BuildCmap();
+ $this->BuildHhea();
+ $this->BuildHmtx();
+ $this->BuildLoca();
+ $this->BuildGlyf();
+ $this->BuildMaxp();
+ $this->BuildPost();
+ return $this->BuildFont();
+ }
+
+ function BuildCmap()
+ {
+ if(!isset($this->subsettedChars))
+ return;
+
+ // Divide charset in contiguous segments
+ $chars = $this->subsettedChars;
+ sort($chars);
+ $segments = array();
+ $segment = array($chars[0], $chars[0]);
+ for($i=1;$i<count($chars);$i++)
+ {
+ if($chars[$i]>$segment[1]+1)
+ {
+ $segments[] = $segment;
+ $segment = array($chars[$i], $chars[$i]);
+ }
+ else
+ $segment[1]++;
+ }
+ $segments[] = $segment;
+ $segments[] = array(0xFFFF, 0xFFFF);
+ $segCount = count($segments);
+
+ // Build a Format 4 subtable
+ $startCount = array();
+ $endCount = array();
+ $idDelta = array();
+ $idRangeOffset = array();
+ $glyphIdArray = '';
+ for($i=0;$i<$segCount;$i++)
+ {
+ list($start, $end) = $segments[$i];
+ $startCount[] = $start;
+ $endCount[] = $end;
+ if($start!=$end)
+ {
+ // Segment with multiple chars
+ $idDelta[] = 0;
+ $idRangeOffset[] = strlen($glyphIdArray) + ($segCount-$i)*2;
+ for($c=$start;$c<=$end;$c++)
+ {
+ $ssid = $this->glyphs[$this->chars[$c]]['ssid'];
+ $glyphIdArray .= pack('n', $ssid);
+ }
+ }
+ else
+ {
+ // Segment with a single char
+ if($start<0xFFFF)
+ $ssid = $this->glyphs[$this->chars[$start]]['ssid'];
+ else
+ $ssid = 0;
+ $idDelta[] = $ssid - $start;
+ $idRangeOffset[] = 0;
+ }
+ }
+ $entrySelector = 0;
+ $n = $segCount;
+ while($n!=1)
+ {
+ $n = $n>>1;
+ $entrySelector++;
+ }
+ $searchRange = (1<<$entrySelector)*2;
+ $rangeShift = 2*$segCount - $searchRange;
+ $cmap = pack('nnnn', 2*$segCount, $searchRange, $entrySelector, $rangeShift);
+ foreach($endCount as $val)
+ $cmap .= pack('n', $val);
+ $cmap .= pack('n', 0); // reservedPad
+ foreach($startCount as $val)
+ $cmap .= pack('n', $val);
+ foreach($idDelta as $val)
+ $cmap .= pack('n', $val);
+ foreach($idRangeOffset as $val)
+ $cmap .= pack('n', $val);
+ $cmap .= $glyphIdArray;
+
+ $data = pack('nn', 0, 1); // version, numTables
+ $data .= pack('nnN', 3, 1, 12); // platformID, encodingID, offset
+ $data .= pack('nnn', 4, 6+strlen($cmap), 0); // format, length, language
+ $data .= $cmap;
+ $this->SetTable('cmap', $data);
+ }
+
+ function BuildHhea()
+ {
+ $this->LoadTable('hhea');
+ $numberOfHMetrics = count($this->subsettedGlyphs);
+ $data = substr_replace($this->tables['hhea']['data'], pack('n',$numberOfHMetrics), 4+15*2, 2);
+ $this->SetTable('hhea', $data);
+ }
+
+ function BuildHmtx()
+ {
+ $data = '';
+ foreach($this->subsettedGlyphs as $id)
+ {
+ $glyph = $this->glyphs[$id];
+ $data .= pack('nn', $glyph['w'], $glyph['lsb']);
+ }
+ $this->SetTable('hmtx', $data);
+ }
+
+ function BuildLoca()
+ {
+ $data = '';
+ $offset = 0;
+ foreach($this->subsettedGlyphs as $id)
+ {
+ if($this->indexToLocFormat==0)
+ $data .= pack('n', $offset/2);
+ else
+ $data .= pack('N', $offset);
+ $offset += $this->glyphs[$id]['length'];
+ }
+ if($this->indexToLocFormat==0)
+ $data .= pack('n', $offset/2);
+ else
+ $data .= pack('N', $offset);
+ $this->SetTable('loca', $data);
+ }
+
+ function BuildGlyf()
+ {
+ $tableOffset = $this->tables['glyf']['offset'];
+ $data = '';
+ foreach($this->subsettedGlyphs as $id)
+ {
+ $glyph = $this->glyphs[$id];
+ fseek($this->f, $tableOffset+$glyph['offset'], SEEK_SET);
+ $glyph_data = $this->Read($glyph['length']);
+ if(isset($glyph['components']))
+ {
+ // Composite glyph
+ foreach($glyph['components'] as $offset=>$cid)
+ {
+ $ssid = $this->glyphs[$cid]['ssid'];
+ $glyph_data = substr_replace($glyph_data, pack('n',$ssid), $offset, 2);
+ }
+ }
+ $data .= $glyph_data;
+ }
+ $this->SetTable('glyf', $data);
+ }
+
+ function BuildMaxp()
+ {
+ $this->LoadTable('maxp');
+ $numGlyphs = count($this->subsettedGlyphs);
+ $data = substr_replace($this->tables['maxp']['data'], pack('n',$numGlyphs), 4, 2);
+ $this->SetTable('maxp', $data);
+ }
+
+ function BuildPost()
+ {
+ $this->Seek('post');
+ if($this->glyphNames)
+ {
+ // Version 2.0
+ $numberOfGlyphs = count($this->subsettedGlyphs);
+ $numNames = 0;
+ $names = '';
+ $data = $this->Read(2*4+2*2+5*4);
+ $data .= pack('n', $numberOfGlyphs);
+ foreach($this->subsettedGlyphs as $id)
+ {
+ $name = $this->glyphs[$id]['name'];
+ if(is_string($name))
+ {
+ $data .= pack('n', 258+$numNames);
+ $names .= chr(strlen($name)).$name;
+ $numNames++;
+ }
+ else
+ $data .= pack('n', $name);
+ }
+ $data .= $names;
+ }
else
- die("<b>Error</b>: $msg");
+ {
+ // Version 3.0
+ $this->Skip(4);
+ $data = "\x00\x03\x00\x00";
+ $data .= $this->Read(4+2*2+5*4);
+ }
+ $this->SetTable('post', $data);
+ }
+
+ function BuildFont()
+ {
+ $tags = array();
+ foreach(array('cmap', 'cvt ', 'fpgm', 'glyf', 'head', 'hhea', 'hmtx', 'loca', 'maxp', 'name', 'post', 'prep') as $tag)
+ {
+ if(isset($this->tables[$tag]))
+ $tags[] = $tag;
+ }
+ $numTables = count($tags);
+ $offset = 12 + 16*$numTables;
+ foreach($tags as $tag)
+ {
+ if(!isset($this->tables[$tag]['data']))
+ $this->LoadTable($tag);
+ $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;
+ $n = $numTables;
+ while($n!=1)
+ {
+ $n = $n>>1;
+ $entrySelector++;
+ }
+ $searchRange = 16*(1<<$entrySelector);
+ $rangeShift = 16*$numTables - $searchRange;
+ $offsetTable = pack('nnnnnn', 1, 0, $numTables, $searchRange, $entrySelector, $rangeShift);
+ foreach($tags as $tag)
+ {
+ $table = $this->tables[$tag];
+ $offsetTable .= $tag.$table['checkSum'].pack('NN', $table['offset'], $table['length']);
+ }
+
+ // Compute checkSumAdjustment (0xB1B0AFBA - font checkSum)
+ $s = $this->CheckSum($offsetTable);
+ foreach($tags as $tag)
+ $s .= $this->tables[$tag]['checkSum'];
+ $a = unpack('n2', $this->CheckSum($s));
+ $high = 0xB1B0 + ($a[1]^0xFFFF);
+ $low = 0xAFBA + ($a[2]^0xFFFF) + 1;
+ $checkSumAdjustment = pack('nn', $high+($low>>16), $low);
+ $this->tables['head']['data'] = substr_replace($this->tables['head']['data'], $checkSumAdjustment, 8, 4);
+
+ $font = $offsetTable;
+ foreach($tags as $tag)
+ $font .= $this->tables[$tag]['data'];
+
+ return $font;
+ }
+
+ function LoadTable($tag)
+ {
+ $this->Seek($tag);
+ $length = $this->tables[$tag]['length'];
+ $n = $length % 4;
+ if($n>0)
+ $length += 4 - $n;
+ $this->tables[$tag]['data'] = $this->Read($length);
+ }
+
+ function SetTable($tag, $data)
+ {
+ $length = strlen($data);
+ $n = $length % 4;
+ if($n>0)
+ $data = str_pad($data, $length+4-$n, "\x00");
+ $this->tables[$tag]['data'] = $data;
+ $this->tables[$tag]['length'] = $length;
+ $this->tables[$tag]['checkSum'] = $this->CheckSum($data);
}
function Seek($tag)
{
if(!isset($this->tables[$tag]))
$this->Error('Table not found: '.$tag);
- fseek($this->f, $this->tables[$tag], SEEK_SET);
+ fseek($this->f, $this->tables[$tag]['offset'], SEEK_SET);
}
function Skip($n)
@@ -262,7 +678,7 @@ class TTFParser function Read($n)
{
- return fread($this->f, $n);
+ return $n>0 ? fread($this->f, $n) : '';
}
function ReadUShort()
@@ -285,5 +701,23 @@ class TTFParser $a = unpack('NN', fread($this->f,4));
return $a['N'];
}
+
+ function CheckSum($s)
+ {
+ $n = strlen($s);
+ $high = 0;
+ $low = 0;
+ for($i=0;$i<$n;$i+=4)
+ {
+ $high += (ord($s[$i])<<8) + ord($s[$i+1]);
+ $low += (ord($s[$i+2])<<8) + ord($s[$i+3]);
+ }
+ return pack('nn', $high+($low>>16), $low);
+ }
+
+ function Error($msg)
+ {
+ throw new Exception($msg);
+ }
}
?>
diff --git a/pdf/fpdf/tutorial/20k_c1.txt b/pdf/fpdf/tutorial/20k_c1.txt index 0b09f26..0b09f26 100755..100644 --- a/pdf/fpdf/tutorial/20k_c1.txt +++ b/pdf/fpdf/tutorial/20k_c1.txt diff --git a/pdf/fpdf/tutorial/20k_c2.txt b/pdf/fpdf/tutorial/20k_c2.txt index 096dbd1..096dbd1 100755..100644 --- a/pdf/fpdf/tutorial/20k_c2.txt +++ b/pdf/fpdf/tutorial/20k_c2.txt diff --git a/pdf/fpdf/tutorial/calligra.php b/pdf/fpdf/tutorial/calligra.php index baf8a3a..e262f4c 100755..100644 --- a/pdf/fpdf/tutorial/calligra.php +++ b/pdf/fpdf/tutorial/calligra.php @@ -18,6 +18,8 @@ $cw = array( chr(220)=>805,chr(221)=>0,chr(222)=>0,chr(223)=>688,chr(224)=>581,chr(225)=>581,chr(226)=>581,chr(227)=>581,chr(228)=>581,chr(229)=>581,chr(230)=>792,chr(231)=>440,chr(232)=>450,chr(233)=>450,chr(234)=>450,chr(235)=>450,chr(236)=>283,chr(237)=>283,chr(238)=>283,chr(239)=>283,chr(240)=>0,chr(241)=>595,
chr(242)=>508,chr(243)=>508,chr(244)=>508,chr(245)=>508,chr(246)=>508,chr(247)=>0,chr(248)=>508,chr(249)=>614,chr(250)=>614,chr(251)=>614,chr(252)=>614,chr(253)=>0,chr(254)=>0,chr(255)=>597);
$enc = 'cp1252';
+$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
$file = 'calligra.z';
-$originalsize = 40120;
+$originalsize = 33948;
+$subsetted = true;
?>
diff --git a/pdf/fpdf/tutorial/calligra.ttf b/pdf/fpdf/tutorial/calligra.ttf Binary files differindex 9713c46..9713c46 100755..100644 --- a/pdf/fpdf/tutorial/calligra.ttf +++ b/pdf/fpdf/tutorial/calligra.ttf diff --git a/pdf/fpdf/tutorial/calligra.z b/pdf/fpdf/tutorial/calligra.z Binary files differindex 1c0bebd..8a14e9c 100755..100644 --- a/pdf/fpdf/tutorial/calligra.z +++ b/pdf/fpdf/tutorial/calligra.z diff --git a/pdf/fpdf/tutorial/countries.txt b/pdf/fpdf/tutorial/countries.txt index aa8886c..aa8886c 100755..100644 --- a/pdf/fpdf/tutorial/countries.txt +++ b/pdf/fpdf/tutorial/countries.txt diff --git a/pdf/fpdf/tutorial/index.htm b/pdf/fpdf/tutorial/index.htm index 44dba25..87cc484 100755..100644 --- a/pdf/fpdf/tutorial/index.htm +++ b/pdf/fpdf/tutorial/index.htm @@ -14,7 +14,7 @@ <li><a href="tuto4.htm">Tutorial 4</a>: Multi-columns</li>
<li><a href="tuto5.htm">Tutorial 5</a>: Tables</li>
<li><a href="tuto6.htm">Tutorial 6</a>: Links and flowing text</li>
-<li><a href="tuto7.htm">Tutorial 7</a>: Adding new fonts and encoding support</li>
-</UL>
+<li><a href="tuto7.htm">Tutorial 7</a>: Adding new fonts and encodings</li>
+</ul>
</body>
</html>
diff --git a/pdf/fpdf/tutorial/logo.png b/pdf/fpdf/tutorial/logo.png Binary files differindex 284a007..284a007 100755..100644 --- a/pdf/fpdf/tutorial/logo.png +++ b/pdf/fpdf/tutorial/logo.png diff --git a/pdf/fpdf/tutorial/makefont.php b/pdf/fpdf/tutorial/makefont.php index 285f27c..285f27c 100755..100644 --- a/pdf/fpdf/tutorial/makefont.php +++ b/pdf/fpdf/tutorial/makefont.php diff --git a/pdf/fpdf/tutorial/tuto1.htm b/pdf/fpdf/tutorial/tuto1.htm index a26e29a..36fabad 100755..100644 --- a/pdf/fpdf/tutorial/tuto1.htm +++ b/pdf/fpdf/tutorial/tuto1.htm @@ -21,7 +21,7 @@ Let's start with the classic example: </div>
<p class='demo'><a href='tuto1.php' target='_blank' class='demo'>[Demo]</a></p>
After including the library file, we create an FPDF object.
-The <a href='../doc/fpdf.htm'>FPDF()</a> constructor is used here with the default values: pages are in A4 portrait and
+The <a href='../doc/__construct.htm'>constructor</a> is used here with the default values: pages are in A4 portrait and
the unit of measure is millimeter. It could have been specified explicitly with:
<div class="source">
<pre><code>$pdf <span class="kw">= new </span>FPDF<span class="kw">(</span><span class="str">'P'</span><span class="kw">,</span><span class="str">'mm'</span><span class="kw">,</span><span class="str">'A4'</span><span class="kw">);
@@ -36,8 +36,8 @@ is at the upper-left corner and the current position is by default set at 1 cm f borders; the margins can be changed with <a href='../doc/setmargins.htm'>SetMargins()</a>.
<br>
<br>
-Before we can print text, it's mandatory to select a font with <a href='../doc/setfont.htm'>SetFont()</a>, otherwise the
-document would be invalid. We choose Arial bold 16:
+Before we can print text, it's mandatory to select a font with <a href='../doc/setfont.htm'>SetFont()</a>.
+We choose Arial bold 16:
<div class="source">
<pre><code>$pdf<span class="kw">-></span>SetFont<span class="kw">(</span><span class="str">'Arial'</span><span class="kw">,</span><span class="str">'B'</span><span class="kw">,</span>16<span class="kw">);
</span></code></pre>
@@ -65,7 +65,7 @@ the height of the break. <br>
<br>
Finally, the document is closed and sent to the browser with <a href='../doc/output.htm'>Output()</a>. We could have saved
-it to a file by passing the desired file name.
+it to a file by passing the appropriate parameters.
<br>
<br>
<strong>Caution:</strong> in case when the PDF is sent to the browser, nothing else must be output by the
diff --git a/pdf/fpdf/tutorial/tuto1.php b/pdf/fpdf/tutorial/tuto1.php index 14a0504..14a0504 100755..100644 --- a/pdf/fpdf/tutorial/tuto1.php +++ b/pdf/fpdf/tutorial/tuto1.php diff --git a/pdf/fpdf/tutorial/tuto2.htm b/pdf/fpdf/tutorial/tuto2.htm index b892d1d..b892d1d 100755..100644 --- a/pdf/fpdf/tutorial/tuto2.htm +++ b/pdf/fpdf/tutorial/tuto2.htm diff --git a/pdf/fpdf/tutorial/tuto2.php b/pdf/fpdf/tutorial/tuto2.php index cc7d51c..cc7d51c 100755..100644 --- a/pdf/fpdf/tutorial/tuto2.php +++ b/pdf/fpdf/tutorial/tuto2.php diff --git a/pdf/fpdf/tutorial/tuto3.htm b/pdf/fpdf/tutorial/tuto3.htm index fa58307..fa58307 100755..100644 --- a/pdf/fpdf/tutorial/tuto3.htm +++ b/pdf/fpdf/tutorial/tuto3.htm diff --git a/pdf/fpdf/tutorial/tuto3.php b/pdf/fpdf/tutorial/tuto3.php index eade51c..eade51c 100755..100644 --- a/pdf/fpdf/tutorial/tuto3.php +++ b/pdf/fpdf/tutorial/tuto3.php diff --git a/pdf/fpdf/tutorial/tuto4.htm b/pdf/fpdf/tutorial/tuto4.htm index c4a4eb8..7af730f 100755..100644 --- a/pdf/fpdf/tutorial/tuto4.htm +++ b/pdf/fpdf/tutorial/tuto4.htm @@ -15,12 +15,10 @@ columns. class </span>PDF <span class="kw">extends </span>FPDF
<span class="kw">{
-</span><span class="cmt">// Current column
-</span><span class="kw">var </span>$col <span class="kw">= </span>0<span class="kw">;
-</span><span class="cmt">// Ordinate of column start
-</span><span class="kw">var </span>$y0<span class="kw">;
+protected </span>$col <span class="kw">= </span>0<span class="kw">; </span><span class="cmt">// Current column
+</span><span class="kw">protected </span>$y0<span class="kw">; </span><span class="cmt">// Ordinate of column start
-function </span>Header<span class="kw">()
+</span><span class="kw">function </span>Header<span class="kw">()
{
</span><span class="cmt">// Page header
</span><span class="kw">global </span>$title<span class="kw">;
diff --git a/pdf/fpdf/tutorial/tuto4.php b/pdf/fpdf/tutorial/tuto4.php index 360d237..f5f4fa8 100755..100644 --- a/pdf/fpdf/tutorial/tuto4.php +++ b/pdf/fpdf/tutorial/tuto4.php @@ -3,10 +3,8 @@ require('../fpdf.php'); class PDF extends FPDF
{
-// Current column
-var $col = 0;
-// Ordinate of column start
-var $y0;
+protected $col = 0; // Current column
+protected $y0; // Ordinate of column start
function Header()
{
diff --git a/pdf/fpdf/tutorial/tuto5.htm b/pdf/fpdf/tutorial/tuto5.htm index 03fdd54..03fdd54 100755..100644 --- a/pdf/fpdf/tutorial/tuto5.htm +++ b/pdf/fpdf/tutorial/tuto5.htm diff --git a/pdf/fpdf/tutorial/tuto5.php b/pdf/fpdf/tutorial/tuto5.php index f1b64a2..f1b64a2 100755..100644 --- a/pdf/fpdf/tutorial/tuto5.php +++ b/pdf/fpdf/tutorial/tuto5.php diff --git a/pdf/fpdf/tutorial/tuto6.htm b/pdf/fpdf/tutorial/tuto6.htm index 2b98d20..24516e6 100755..100644 --- a/pdf/fpdf/tutorial/tuto6.htm +++ b/pdf/fpdf/tutorial/tuto6.htm @@ -15,21 +15,10 @@ mode. It also contains a basic HTML parser. class </span>PDF <span class="kw">extends </span>FPDF
<span class="kw">{
-var </span>$B<span class="kw">;
-var </span>$I<span class="kw">;
-var </span>$U<span class="kw">;
-var </span>$HREF<span class="kw">;
-
-function </span>PDF<span class="kw">(</span>$orientation<span class="kw">=</span><span class="str">'P'</span><span class="kw">, </span>$unit<span class="kw">=</span><span class="str">'mm'</span><span class="kw">, </span>$size<span class="kw">=</span><span class="str">'A4'</span><span class="kw">)
-{
- </span><span class="cmt">// Call parent constructor
- </span>$<span class="kw">this-></span>FPDF<span class="kw">(</span>$orientation<span class="kw">,</span>$unit<span class="kw">,</span>$size<span class="kw">);
- </span><span class="cmt">// Initialization
- </span>$<span class="kw">this-></span>B <span class="kw">= </span>0<span class="kw">;
- </span>$<span class="kw">this-></span>I <span class="kw">= </span>0<span class="kw">;
- </span>$<span class="kw">this-></span>U <span class="kw">= </span>0<span class="kw">;
- </span>$<span class="kw">this-></span>HREF <span class="kw">= </span><span class="str">''</span><span class="kw">;
-}
+protected </span>$B <span class="kw">= </span>0<span class="kw">;
+protected </span>$I <span class="kw">= </span>0<span class="kw">;
+protected </span>$U <span class="kw">= </span>0<span class="kw">;
+protected </span>$HREF <span class="kw">= </span><span class="str">''</span><span class="kw">;
function </span>WriteHTML<span class="kw">(</span>$html<span class="kw">)
{
diff --git a/pdf/fpdf/tutorial/tuto6.php b/pdf/fpdf/tutorial/tuto6.php index 88fdd51..66580e9 100755..100644 --- a/pdf/fpdf/tutorial/tuto6.php +++ b/pdf/fpdf/tutorial/tuto6.php @@ -3,21 +3,10 @@ require('../fpdf.php'); class PDF extends FPDF
{
-var $B;
-var $I;
-var $U;
-var $HREF;
-
-function PDF($orientation='P', $unit='mm', $size='A4')
-{
- // Call parent constructor
- $this->FPDF($orientation,$unit,$size);
- // Initialization
- $this->B = 0;
- $this->I = 0;
- $this->U = 0;
- $this->HREF = '';
-}
+protected $B = 0;
+protected $I = 0;
+protected $U = 0;
+protected $HREF = '';
function WriteHTML($html)
{
diff --git a/pdf/fpdf/tutorial/tuto7.htm b/pdf/fpdf/tutorial/tuto7.htm index 21a3f6e..b42e552 100755..100644 --- a/pdf/fpdf/tutorial/tuto7.htm +++ b/pdf/fpdf/tutorial/tuto7.htm @@ -2,32 +2,18 @@ <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Adding new fonts and encoding support</title>
+<title>Adding new fonts and encodings</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
-<style type="text/css">
-table {border-collapse:collapse; border-style:solid; border-width:2px; border-color:#A0A0A0 #000000 #000000 #A0A0A0}
-table {margin:1.4em 0 1.4em 1em}
-th {background-color:#E0EBFF; color:#900000; text-align:left}
-th, td {border:1px solid #808080; padding:2px 10px}
-tr.alt0 {background-color:#FFFFEE}
-tr.alt1 {background-color:#FFFFE0}
-</style>
</head>
<body>
-<h1>Adding new fonts and encoding support</h1>
-This tutorial explains how to use TrueType, OpenType and Type1 fonts so that you are not limited to
-the standard fonts any more. The other benefit is that you can choose the font encoding, which allows
-you to use other languages than the Western ones (the standard fonts having too few available characters).
+<h1>Adding new fonts and encodings</h1>
+This tutorial explains how to use TrueType, OpenType and Type1 fonts so that you are not limited to the
+standard fonts anymore. The other benefit is that you can choose the text encoding, which allows you to
+use other languages than the Western ones (the standard fonts support only cp1252 aka windows-1252).
<br>
<br>
-Remark: for OpenType, only the format based on TrueType is supported (not the one based on Type1).
-<br>
-<br>
-There are two ways to use a new font: embedding it in the PDF or not. When a font is not
-embedded, it is searched in the system. The advantage is that the PDF file is lighter; on the other
-hand, if it's not available, a substitution font is used. So it's preferable to ensure that the
-needed font is installed on the client systems. If the file is to be viewed by a large audience,
-it's highly recommended to embed.
+For OpenType, only the format based on TrueType is supported (not the one based on Type1).<br>
+For Type1, you will need the corresponding AFM file (it is usually provided with the font).
<br>
<br>
Adding a new font requires two steps:
@@ -35,7 +21,6 @@ Adding a new font requires two steps: <li>Generation of the font definition file</li>
<li>Declaration of the font in the script</li>
</ul>
-For Type1, you need the corresponding AFM file. It's usually provided with the font.
<h2>Generation of the font definition file</h2>
The first step consists in generating a PHP file containing all the information needed by FPDF;
@@ -43,7 +28,7 @@ in addition, the font file is compressed. To do this, a helper script is provide directory of the package: makefont.php. It contains the following function:
<br>
<br>
-<code>MakeFont(<b>string</b> fontfile, [, <b>string</b> enc [, <b>boolean</b> embed]])</code>
+<code>MakeFont(<b>string</b> fontfile [, <b>string</b> enc [, <b>boolean</b> embed [, <b>boolean</b> subset]]])</code>
<dl class="param" style="margin-bottom:2em">
<dt><code>fontfile</code></dt>
<dd>
@@ -57,6 +42,10 @@ directory of the package: makefont.php. It contains the following function: <dd>
<p>Whether to embed the font or not. Default value: <code>true</code>.</p>
</dd>
+<dt><code>subset</code></dt>
+<dd>
+<p>Whether to subset the font or not. Default value: <code>true</code>.</p>
+</dd>
</dl>
The first parameter is the name of the font file. The extension must be either .ttf, .otf or .pfb and
determines the font type. If your Type1 font is in ASCII format (.pfa), you can convert it to binary
@@ -91,10 +80,19 @@ files. The available ones are: <li>KOI8-R (Russian)</li>
<li>KOI8-U (Ukrainian)</li>
</ul>
-Of course, the font must contain the characters corresponding to the chosen encoding.
+Of course, the font must contain the characters corresponding to the selected encoding.
<br>
<br>
-Remark: the standard fonts use cp1252.
+The third parameter indicates whether the font should be embedded in the PDF or not. When a font is
+not embedded, it is searched in the system. The advantage is that the PDF file is smaller; on the
+other hand, if it is not available, then a substitution font is used. So you should ensure that the
+needed font is installed on the client systems. Embedding is the recommended option to guarantee a
+correct rendering.
+<br>
+<br>
+The last parameter indicates whether subsetting should be used, that is to say, whether only
+the characters from the selected encoding should be kept in the embedded font. As a result,
+the size of the PDF file can be greatly reduced, especially if the original font was big.
<br>
<br>
After you have called the function (create a new file for this and include makefont.php), a .php file
@@ -109,7 +107,7 @@ Example: <pre><code><?php
<span class="kw">require(</span><span class="str">'makefont/makefont.php'</span><span class="kw">);
-</span>MakeFont<span class="kw">(</span><span class="str">'c:\\Windows\\Fonts\\comic.ttf'</span><span class="kw">,</span><span class="str">'cp1252'</span><span class="kw">);
+</span>MakeFont<span class="kw">(</span><span class="str">'C:\\Windows\\Fonts\\comic.ttf'</span><span class="kw">,</span><span class="str">'cp1252'</span><span class="kw">);
</span>?></code></pre>
</div>
which gives the files comic.php and comic.z.
@@ -122,7 +120,7 @@ it directly instead of the .z version. Another way to call MakeFont() is through the command line:
<br>
<br>
-<kbd>php makefont\makefont.php c:\Windows\Fonts\comic.ttf cp1252</kbd>
+<kbd>php makefont\makefont.php C:\Windows\Fonts\comic.ttf cp1252</kbd>
<br>
<br>
Finally, for TrueType and OpenType fonts, you can also generate the files
@@ -185,57 +183,5 @@ We can now copy the two generated files to the font directory and write the scri </span>?></code></pre>
</div>
<p class='demo'><a href='tuto7.php' target='_blank' class='demo'>[Demo]</a></p>
-
-<h2>About the euro symbol</h2>
-The euro character is not present in all encodings, and is not always placed at the same position:
-<table>
-<tr><th>Encoding</th><th>Position</th></tr>
-<tr class="alt0"><td>cp1250</td><td>128</td></tr>
-<tr class="alt1"><td>cp1251</td><td>136</td></tr>
-<tr class="alt0"><td>cp1252</td><td>128</td></tr>
-<tr class="alt1"><td>cp1253</td><td>128</td></tr>
-<tr class="alt0"><td>cp1254</td><td>128</td></tr>
-<tr class="alt1"><td>cp1255</td><td>128</td></tr>
-<tr class="alt0"><td>cp1257</td><td>128</td></tr>
-<tr class="alt1"><td>cp1258</td><td>128</td></tr>
-<tr class="alt0"><td>cp874</td><td>128</td></tr>
-<tr class="alt1"><td>ISO-8859-1</td><td>N/A</td></tr>
-<tr class="alt0"><td>ISO-8859-2</td><td>N/A</td></tr>
-<tr class="alt1"><td>ISO-8859-4</td><td>N/A</td></tr>
-<tr class="alt0"><td>ISO-8859-5</td><td>N/A</td></tr>
-<tr class="alt1"><td>ISO-8859-7</td><td>N/A</td></tr>
-<tr class="alt0"><td>ISO-8859-9</td><td>N/A</td></tr>
-<tr class="alt1"><td>ISO-8859-11</td><td>N/A</td></tr>
-<tr class="alt0"><td>ISO-8859-15</td><td>164</td></tr>
-<tr class="alt1"><td>ISO-8859-16</td><td>164</td></tr>
-<tr class="alt0"><td>KOI8-R</td><td>N/A</td></tr>
-<tr class="alt1"><td>KOI8-U</td><td>N/A</td></tr>
-</table>
-ISO-8859-1 is widespread but does not include the euro sign. If you need it, the simplest thing
-to do is to use cp1252 or ISO-8859-15 instead, which are nearly identical but contain the precious
-symbol.
-
-<h2>Reducing the size of TrueType fonts</h2>
-Font files are often quite voluminous; this is due to the fact that they contain the characters
-corresponding to many encodings. Zlib compression reduces them but they remain fairly big. A
-technique exists to reduce them further. It consists in converting the font to the Type1 format
-with <a href="http://ttf2pt1.sourceforge.net" target="_blank">ttf2pt1</a> (the Windows binary is
-available <a href="http://www.fpdf.org/fr/dl.php?id=22">here</a>) while specifying the encoding
-you are interested in; all other characters will be discarded.
-<br>
-For example, the arial.ttf font that ships with Windows Vista weights 748 KB (it contains 3381 characters).
-After compression it drops to 411. Let's convert it to Type1 by keeping only cp1250 characters:
-<br>
-<br>
-<kbd>ttf2pt1 -b -L cp1250.map c:\Windows\Fonts\arial.ttf arial</kbd>
-<br>
-<br>
-The .map files are located in the makefont directory of the package. The command produces
-arial.pfb and arial.afm. The arial.pfb file weights only 57 KB, and 53 after compression.
-<br>
-<br>
-It's possible to go even further. If you are interested only by a subset of the encoding (you
-probably don't need all 217 characters), you can open the .map file and remove the lines you are
-not interested in. This will reduce the file size accordingly.
</body>
</html>
diff --git a/pdf/fpdf/tutorial/tuto7.php b/pdf/fpdf/tutorial/tuto7.php index d1127f3..d1127f3 100755..100644 --- a/pdf/fpdf/tutorial/tuto7.php +++ b/pdf/fpdf/tutorial/tuto7.php diff --git a/pdf/mentor_cert_pdf.inc b/pdf/mentor_cert_pdf.inc index e40de30..900fccb 100755 --- a/pdf/mentor_cert_pdf.inc +++ b/pdf/mentor_cert_pdf.inc @@ -35,7 +35,7 @@ function generate_pdf() } //!$pdf $pdf->AddPage(); $image_bg = $mpath . "/pdf/images/bg_cert_mentor.png"; - $pdf->Image($image_bg, 0, 0, $pdf->w, $pdf->h); + $pdf->Image($image_bg, 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight()); $pdf->SetMargins(18, 1, 18); $path = drupal_get_path('module', 'om_pssp'); $pdf->Ln(43); @@ -45,7 +45,7 @@ function generate_pdf() $pdf->Ln(-6); $pdf->SetFont('Times', 'BI', 16); $pdf->SetTextColor(13, 5, 130); - $pdf->Cell(240, 8, $data3->project_guide_name, '0', '1', 'C'); + $pdf->Cell(240, 8, utf8_decode($data3->project_guide_name), '0', '1', 'C'); $pdf->Ln(0); $pdf->SetFont('Times', 'I', 12); if (strtolower($data3->branch) != "others") { @@ -54,20 +54,20 @@ function generate_pdf() $pdf->Cell(240, 8, 'from', '0', '1', 'C'); $pdf->Ln(0); $pdf->SetFont('Times','BI',16); - $pdf->Cell(240, 8, $data3->project_guide_university, '0','1','C'); + $pdf->Cell(240, 8, utf8_decode($data3->project_guide_university), '0','1','C'); $pdf->Ln(0); $pdf->SetFont('Times', 'I', 12); $pdf->Cell(240, 8, 'who has mentored', '0', '1', 'C'); $pdf->Ln(0); $pdf->SetFont('Times', 'BI', 16); - $pdf->Cell(240, 8, $data3->contributor_name, '0', '1', 'C'); + $pdf->Cell(240, 8, utf8_decode($data3->contributor_name), '0', '1', 'C'); $pdf->Ln(0); $pdf->SetFont('Times', 'I', 12); $pdf->Cell(240, 8, 'for successfully completing internship under the Power System Simulation Project. The intern(s) has created a Simulation titled', '0', '1', 'C'); $pdf->Ln(0); $pdf->SetFont('Times', 'BI', 16); $pdf->SetTextColor(13, 5, 130); - $pdf->Cell(240, 8, $data3->project_title, '0', '1', 'C'); + $pdf->Cell(240, 8, utf8_decode($data3->project_title), '0', '1', 'C'); $pdf->SetTextColor(13, 5, 130); $pdf->Ln(0); $pdf->SetFont('Times', 'I', 12); @@ -114,18 +114,26 @@ function generate_pdf() $filename = str_replace(' ', '-', $data3->project_guide_name) . '-OpenModelica-PSSP-Mentor-Certificate.pdf'; $file = $path . '/pdf/temp_certificate/' . $proposal_id . '_' . $filename; $pdf->Output($file, 'F'); - header("Content-Type: application/octet-stream"); - header("Content-Disposition: attachment; filename=" . $filename); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); + ob_clean(); + header("Pragma: public"); + header("Expires: 0"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Cache-Control: public"); header("Content-Description: File Transfer"); + header("Content-Type: application/pdf"); + header("Content-Disposition: attachment; filename=" . $filename); header("Content-Length: " . filesize($file)); + header("Content-Transfer-Encoding: binary"); + header("Expires: 0"); + header("Pragma: no-cache"); flush(); $fp = fopen($file, "r"); while (!feof($fp)) { - echo fread($fp, 65536); + echo fread($fp, filesize($file)); flush(); } //!feof($fp) + ob_end_flush(); + ob_clean(); fclose($fp); unlink($file); //drupal_goto('flowsheeting-project/certificate'); |