From 56f7a3990023caa0052dbb1b9185b03c56c35517 Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Wed, 7 Oct 2020 12:53:11 +0530 Subject: Update FPDF version --- pdf/fpdf/FAQ.htm | 223 ++++------ pdf/fpdf/changelog.htm | 23 +- pdf/fpdf/doc/__construct.htm | 63 +++ pdf/fpdf/doc/acceptpagebreak.htm | 4 +- pdf/fpdf/doc/addfont.htm | 2 +- pdf/fpdf/doc/addlink.htm | 10 +- pdf/fpdf/doc/addpage.htm | 15 +- pdf/fpdf/doc/aliasnbpages.htm | 4 +- pdf/fpdf/doc/cell.htm | 20 +- pdf/fpdf/doc/close.htm | 2 +- pdf/fpdf/doc/error.htm | 7 +- pdf/fpdf/doc/footer.htm | 2 +- pdf/fpdf/doc/getpageheight.htm | 18 + pdf/fpdf/doc/getpagewidth.htm | 18 + pdf/fpdf/doc/getstringwidth.htm | 0 pdf/fpdf/doc/getx.htm | 6 +- pdf/fpdf/doc/gety.htm | 6 +- pdf/fpdf/doc/header.htm | 2 +- pdf/fpdf/doc/image.htm | 2 +- pdf/fpdf/doc/index.htm | 10 +- pdf/fpdf/doc/line.htm | 4 +- pdf/fpdf/doc/link.htm | 8 +- pdf/fpdf/doc/ln.htm | 2 +- pdf/fpdf/doc/multicell.htm | 16 +- pdf/fpdf/doc/output.htm | 36 +- pdf/fpdf/doc/pageno.htm | 2 +- pdf/fpdf/doc/rect.htm | 6 +- pdf/fpdf/doc/setauthor.htm | 8 +- pdf/fpdf/doc/setautopagebreak.htm | 6 +- pdf/fpdf/doc/setcompression.htm | 0 pdf/fpdf/doc/setcreator.htm | 8 +- pdf/fpdf/doc/setdisplaymode.htm | 0 pdf/fpdf/doc/setdrawcolor.htm | 12 +- pdf/fpdf/doc/setfillcolor.htm | 10 +- pdf/fpdf/doc/setfont.htm | 10 +- pdf/fpdf/doc/setfontsize.htm | 2 +- pdf/fpdf/doc/setkeywords.htm | 8 +- pdf/fpdf/doc/setleftmargin.htm | 8 +- pdf/fpdf/doc/setlinewidth.htm | 8 +- pdf/fpdf/doc/setlink.htm | 2 +- pdf/fpdf/doc/setmargins.htm | 8 +- pdf/fpdf/doc/setrightmargin.htm | 8 +- pdf/fpdf/doc/setsubject.htm | 8 +- pdf/fpdf/doc/settextcolor.htm | 10 +- pdf/fpdf/doc/settitle.htm | 8 +- pdf/fpdf/doc/settopmargin.htm | 8 +- pdf/fpdf/doc/setx.htm | 8 +- pdf/fpdf/doc/setxy.htm | 4 +- pdf/fpdf/doc/sety.htm | 16 +- pdf/fpdf/doc/text.htm | 10 +- pdf/fpdf/doc/write.htm | 10 +- pdf/fpdf/font/courier.php | 2 + pdf/fpdf/font/courierb.php | 2 + pdf/fpdf/font/courierbi.php | 2 + pdf/fpdf/font/courieri.php | 2 + pdf/fpdf/font/helvetica.php | 2 + pdf/fpdf/font/helveticab.php | 2 + pdf/fpdf/font/helveticabi.php | 2 + pdf/fpdf/font/helveticai.php | 2 + pdf/fpdf/font/symbol.php | 1 + pdf/fpdf/font/times.php | 2 + pdf/fpdf/font/timesb.php | 2 + pdf/fpdf/font/timesbi.php | 2 + pdf/fpdf/font/timesi.php | 2 + pdf/fpdf/font/zapfdingbats.php | 1 + pdf/fpdf/fpdf.css | 2 +- pdf/fpdf/fpdf.php | 902 +++++++++++++++++++++----------------- pdf/fpdf/install.txt | 0 pdf/fpdf/license.txt | 0 pdf/fpdf/makefont/cp1250.map | 0 pdf/fpdf/makefont/cp1251.map | 0 pdf/fpdf/makefont/cp1252.map | 0 pdf/fpdf/makefont/cp1253.map | 0 pdf/fpdf/makefont/cp1254.map | 0 pdf/fpdf/makefont/cp1255.map | 0 pdf/fpdf/makefont/cp1257.map | 0 pdf/fpdf/makefont/cp1258.map | 0 pdf/fpdf/makefont/cp874.map | 0 pdf/fpdf/makefont/iso-8859-1.map | 0 pdf/fpdf/makefont/iso-8859-11.map | 0 pdf/fpdf/makefont/iso-8859-15.map | 0 pdf/fpdf/makefont/iso-8859-16.map | 0 pdf/fpdf/makefont/iso-8859-2.map | 0 pdf/fpdf/makefont/iso-8859-4.map | 0 pdf/fpdf/makefont/iso-8859-5.map | 0 pdf/fpdf/makefont/iso-8859-7.map | 0 pdf/fpdf/makefont/iso-8859-9.map | 0 pdf/fpdf/makefont/koi8-r.map | 0 pdf/fpdf/makefont/koi8-u.map | 0 pdf/fpdf/makefont/makefont.php | 144 ++++-- pdf/fpdf/makefont/ttfparser.php | 544 ++++++++++++++++++++--- pdf/fpdf/tutorial/20k_c1.txt | 0 pdf/fpdf/tutorial/20k_c2.txt | 0 pdf/fpdf/tutorial/calligra.php | 4 +- pdf/fpdf/tutorial/calligra.ttf | Bin pdf/fpdf/tutorial/calligra.z | Bin 25604 -> 22477 bytes pdf/fpdf/tutorial/countries.txt | 0 pdf/fpdf/tutorial/index.htm | 4 +- pdf/fpdf/tutorial/logo.png | Bin pdf/fpdf/tutorial/makefont.php | 0 pdf/fpdf/tutorial/tuto1.htm | 8 +- pdf/fpdf/tutorial/tuto1.php | 0 pdf/fpdf/tutorial/tuto2.htm | 0 pdf/fpdf/tutorial/tuto2.php | 0 pdf/fpdf/tutorial/tuto3.htm | 0 pdf/fpdf/tutorial/tuto3.php | 0 pdf/fpdf/tutorial/tuto4.htm | 8 +- pdf/fpdf/tutorial/tuto4.php | 6 +- pdf/fpdf/tutorial/tuto5.htm | 0 pdf/fpdf/tutorial/tuto5.php | 0 pdf/fpdf/tutorial/tuto6.htm | 19 +- pdf/fpdf/tutorial/tuto6.php | 19 +- pdf/fpdf/tutorial/tuto7.htm | 104 ++--- pdf/fpdf/tutorial/tuto7.php | 0 114 files changed, 1546 insertions(+), 935 deletions(-) mode change 100755 => 100644 pdf/fpdf/FAQ.htm mode change 100755 => 100644 pdf/fpdf/changelog.htm create mode 100644 pdf/fpdf/doc/__construct.htm mode change 100755 => 100644 pdf/fpdf/doc/acceptpagebreak.htm mode change 100755 => 100644 pdf/fpdf/doc/addfont.htm mode change 100755 => 100644 pdf/fpdf/doc/addlink.htm mode change 100755 => 100644 pdf/fpdf/doc/addpage.htm mode change 100755 => 100644 pdf/fpdf/doc/aliasnbpages.htm mode change 100755 => 100644 pdf/fpdf/doc/cell.htm mode change 100755 => 100644 pdf/fpdf/doc/close.htm mode change 100755 => 100644 pdf/fpdf/doc/error.htm mode change 100755 => 100644 pdf/fpdf/doc/footer.htm create mode 100644 pdf/fpdf/doc/getpageheight.htm create mode 100644 pdf/fpdf/doc/getpagewidth.htm mode change 100755 => 100644 pdf/fpdf/doc/getstringwidth.htm mode change 100755 => 100644 pdf/fpdf/doc/getx.htm mode change 100755 => 100644 pdf/fpdf/doc/gety.htm mode change 100755 => 100644 pdf/fpdf/doc/header.htm mode change 100755 => 100644 pdf/fpdf/doc/image.htm mode change 100755 => 100644 pdf/fpdf/doc/index.htm mode change 100755 => 100644 pdf/fpdf/doc/line.htm mode change 100755 => 100644 pdf/fpdf/doc/link.htm mode change 100755 => 100644 pdf/fpdf/doc/ln.htm mode change 100755 => 100644 pdf/fpdf/doc/multicell.htm mode change 100755 => 100644 pdf/fpdf/doc/output.htm mode change 100755 => 100644 pdf/fpdf/doc/pageno.htm mode change 100755 => 100644 pdf/fpdf/doc/rect.htm mode change 100755 => 100644 pdf/fpdf/doc/setauthor.htm mode change 100755 => 100644 pdf/fpdf/doc/setautopagebreak.htm mode change 100755 => 100644 pdf/fpdf/doc/setcompression.htm mode change 100755 => 100644 pdf/fpdf/doc/setcreator.htm mode change 100755 => 100644 pdf/fpdf/doc/setdisplaymode.htm mode change 100755 => 100644 pdf/fpdf/doc/setdrawcolor.htm mode change 100755 => 100644 pdf/fpdf/doc/setfillcolor.htm mode change 100755 => 100644 pdf/fpdf/doc/setfont.htm mode change 100755 => 100644 pdf/fpdf/doc/setfontsize.htm mode change 100755 => 100644 pdf/fpdf/doc/setkeywords.htm mode change 100755 => 100644 pdf/fpdf/doc/setleftmargin.htm mode change 100755 => 100644 pdf/fpdf/doc/setlinewidth.htm mode change 100755 => 100644 pdf/fpdf/doc/setlink.htm mode change 100755 => 100644 pdf/fpdf/doc/setmargins.htm mode change 100755 => 100644 pdf/fpdf/doc/setrightmargin.htm mode change 100755 => 100644 pdf/fpdf/doc/setsubject.htm mode change 100755 => 100644 pdf/fpdf/doc/settextcolor.htm mode change 100755 => 100644 pdf/fpdf/doc/settitle.htm mode change 100755 => 100644 pdf/fpdf/doc/settopmargin.htm mode change 100755 => 100644 pdf/fpdf/doc/setx.htm mode change 100755 => 100644 pdf/fpdf/doc/setxy.htm mode change 100755 => 100644 pdf/fpdf/doc/sety.htm mode change 100755 => 100644 pdf/fpdf/doc/text.htm mode change 100755 => 100644 pdf/fpdf/doc/write.htm mode change 100755 => 100644 pdf/fpdf/font/courier.php mode change 100755 => 100644 pdf/fpdf/font/courierb.php mode change 100755 => 100644 pdf/fpdf/font/courierbi.php mode change 100755 => 100644 pdf/fpdf/font/courieri.php mode change 100755 => 100644 pdf/fpdf/font/helvetica.php mode change 100755 => 100644 pdf/fpdf/font/helveticab.php mode change 100755 => 100644 pdf/fpdf/font/helveticabi.php mode change 100755 => 100644 pdf/fpdf/font/helveticai.php mode change 100755 => 100644 pdf/fpdf/font/symbol.php mode change 100755 => 100644 pdf/fpdf/font/times.php mode change 100755 => 100644 pdf/fpdf/font/timesb.php mode change 100755 => 100644 pdf/fpdf/font/timesbi.php mode change 100755 => 100644 pdf/fpdf/font/timesi.php mode change 100755 => 100644 pdf/fpdf/font/zapfdingbats.php mode change 100755 => 100644 pdf/fpdf/fpdf.css mode change 100755 => 100644 pdf/fpdf/fpdf.php mode change 100755 => 100644 pdf/fpdf/install.txt mode change 100755 => 100644 pdf/fpdf/license.txt mode change 100755 => 100644 pdf/fpdf/makefont/cp1250.map mode change 100755 => 100644 pdf/fpdf/makefont/cp1251.map mode change 100755 => 100644 pdf/fpdf/makefont/cp1252.map mode change 100755 => 100644 pdf/fpdf/makefont/cp1253.map mode change 100755 => 100644 pdf/fpdf/makefont/cp1254.map mode change 100755 => 100644 pdf/fpdf/makefont/cp1255.map mode change 100755 => 100644 pdf/fpdf/makefont/cp1257.map mode change 100755 => 100644 pdf/fpdf/makefont/cp1258.map mode change 100755 => 100644 pdf/fpdf/makefont/cp874.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-1.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-11.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-15.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-16.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-2.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-4.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-5.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-7.map mode change 100755 => 100644 pdf/fpdf/makefont/iso-8859-9.map mode change 100755 => 100644 pdf/fpdf/makefont/koi8-r.map mode change 100755 => 100644 pdf/fpdf/makefont/koi8-u.map mode change 100755 => 100644 pdf/fpdf/makefont/makefont.php mode change 100755 => 100644 pdf/fpdf/makefont/ttfparser.php mode change 100755 => 100644 pdf/fpdf/tutorial/20k_c1.txt mode change 100755 => 100644 pdf/fpdf/tutorial/20k_c2.txt mode change 100755 => 100644 pdf/fpdf/tutorial/calligra.php mode change 100755 => 100644 pdf/fpdf/tutorial/calligra.ttf mode change 100755 => 100644 pdf/fpdf/tutorial/calligra.z mode change 100755 => 100644 pdf/fpdf/tutorial/countries.txt mode change 100755 => 100644 pdf/fpdf/tutorial/index.htm mode change 100755 => 100644 pdf/fpdf/tutorial/logo.png mode change 100755 => 100644 pdf/fpdf/tutorial/makefont.php mode change 100755 => 100644 pdf/fpdf/tutorial/tuto1.htm mode change 100755 => 100644 pdf/fpdf/tutorial/tuto1.php mode change 100755 => 100644 pdf/fpdf/tutorial/tuto2.htm mode change 100755 => 100644 pdf/fpdf/tutorial/tuto2.php mode change 100755 => 100644 pdf/fpdf/tutorial/tuto3.htm mode change 100755 => 100644 pdf/fpdf/tutorial/tuto3.php mode change 100755 => 100644 pdf/fpdf/tutorial/tuto4.htm mode change 100755 => 100644 pdf/fpdf/tutorial/tuto4.php mode change 100755 => 100644 pdf/fpdf/tutorial/tuto5.htm mode change 100755 => 100644 pdf/fpdf/tutorial/tuto5.php mode change 100755 => 100644 pdf/fpdf/tutorial/tuto6.htm mode change 100755 => 100644 pdf/fpdf/tutorial/tuto6.php mode change 100755 => 100644 pdf/fpdf/tutorial/tuto7.htm mode change 100755 => 100644 pdf/fpdf/tutorial/tuto7.php diff --git a/pdf/fpdf/FAQ.htm b/pdf/fpdf/FAQ.htm old mode 100755 new mode 100644 index 05d85c6..f41ad8a --- a/pdf/fpdf/FAQ.htm +++ b/pdf/fpdf/FAQ.htm @@ -14,19 +14,19 @@ ul#answers li {margin-top:1.8em}

FAQ

diff --git a/pdf/fpdf/changelog.htm b/pdf/fpdf/changelog.htm old mode 100755 new mode 100644 index 2549c38..11362d2 --- a/pdf/fpdf/changelog.htm +++ b/pdf/fpdf/changelog.htm @@ -11,6 +11,27 @@ dd {margin:1em 0 1em 1em}

Changelog

+
v1.82 (2019-12-07)
+
+- Removed a deprecation notice under PHP 7.4.
+
+
v1.81 (2015-12-20)
+
+- Added GetPageWidth() and GetPageHeight().
+- Fixed a bug in SetXY().
+
+
v1.8 (2015-11-29)
+
+- PHP 5.1.0 or higher is now required.
+- The MakeFont utility now subsets fonts, which can greatly reduce font sizes.
+- Added ToUnicode CMaps to improve text extraction.
+- Added a parameter to AddPage() to rotate the page.
+- Added a parameter to SetY() to indicate whether the x position should be reset or not.
+- 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).
+- The Error() method now throws an exception.
+- Adding contents before the first AddPage() or after Close() now raises an error.
+- Outputting text with no font selected now raises an error.
+
v1.7 (2011-06-18)
- The MakeFont utility has been completely rewritten and doesn't depend on ttf2pt1 anymore.
@@ -65,7 +86,7 @@ dd {margin:1em 0 1em 1em}
- Type1 font support.
- Added Baltic encoding.
-- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5 :
  * The line thickness was too large when printed under Windows 98 SE and ME.
  * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.
+- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5:
  * The line thickness was too large when printed under Windows 98 SE and ME.
  * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.
- It's no longer necessary to set the decimal separator as dot to produce valid documents.
- The clickable area in a cell was always on the left independently from the text alignment.
- JPEG images in CMYK mode appeared in inverted colors.
diff --git a/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 @@ + + + + +__construct + + + +

__construct

+__construct([string orientation [, string unit [, mixed size]]]) +

Description

+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). +

Parameters

+
+
orientation
+
+Default page orientation. Possible values are (case insensitive): +
    +
  • P or Portrait
  • +
  • L or Landscape
  • +
+Default value is P. +
+
unit
+
+User unit. Possible values are: +
    +
  • pt: point
  • +
  • mm: millimeter
  • +
  • cm: centimeter
  • +
  • in: inch
  • +
+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. +
+
+Default value is mm. +
+
size
+
+The size used for pages. It can be either one of the following values (case insensitive): +
    +
  • A3
  • +
  • A4
  • +
  • A5
  • +
  • Letter
  • +
  • Legal
  • +
+or an array containing the width and the height (expressed in the unit given by unit).
+
+Default value is A4. +
+
+

Example

+Example with a custom 100x150 mm page size: +
+
$pdf = new FPDF('P','mm',array(100,150));
+
+
+
Index
+ + diff --git a/pdf/fpdf/doc/acceptpagebreak.htm b/pdf/fpdf/doc/acceptpagebreak.htm old mode 100755 new mode 100644 index 810aabd..1b2d3ea --- 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();

See also

-SetAutoPageBreak(). +SetAutoPageBreak
Index
diff --git a/pdf/fpdf/doc/addfont.htm b/pdf/fpdf/doc/addfont.htm old mode 100755 new mode 100644 index 90dc361..b743191 --- a/pdf/fpdf/doc/addfont.htm +++ b/pdf/fpdf/doc/addfont.htm @@ -48,7 +48,7 @@ is equivalent to:
$pdf->AddFont('Comic','I','comici.php');

See also

-SetFont(). +SetFont
Index
diff --git a/pdf/fpdf/doc/addlink.htm b/pdf/fpdf/doc/addlink.htm old mode 100755 new mode 100644 index 5681d58..6260664 --- 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().

See also

-Cell(), -Write(), -Image(), -Link(), -SetLink(). +Cell, +Write, +Image, +Link, +SetLink
Index
diff --git a/pdf/fpdf/doc/addpage.htm b/pdf/fpdf/doc/addpage.htm old mode 100755 new mode 100644 index fde79aa..fb014f5 --- a/pdf/fpdf/doc/addpage.htm +++ b/pdf/fpdf/doc/addpage.htm @@ -7,7 +7,7 @@

AddPage

-AddPage([string orientation [, mixed size]]) +AddPage([string orientation [, mixed size [, int rotation]]])

Description

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).

The default value is the one passed to the constructor.
+
rotation
+
+Angle by which to rotate the page. It must be a multiple of 90; positive values +mean clockwise rotation. The default value is 0. +

See also

-FPDF(), -Header(), -Footer(), -SetMargins(). +__construct, +Header, +Footer, +SetMargins
Index
diff --git a/pdf/fpdf/doc/aliasnbpages.htm b/pdf/fpdf/doc/aliasnbpages.htm old mode 100755 new mode 100644 index 53fdf68..26e02c5 --- a/pdf/fpdf/doc/aliasnbpages.htm +++ b/pdf/fpdf/doc/aliasnbpages.htm @@ -37,8 +37,8 @@ $pdf = new PDF(); $pdf->AliasNbPages();

See also

-PageNo(), -Footer(). +PageNo, +Footer
Index
diff --git a/pdf/fpdf/doc/cell.htm b/pdf/fpdf/doc/cell.htm old mode 100755 new mode 100644 index 7480266..f96effb --- 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');

See also

-SetFont(), -SetDrawColor(), -SetFillColor(), -SetTextColor(), -SetLineWidth(), -AddLink(), -Ln(), -MultiCell(), -Write(), -SetAutoPageBreak(). +SetFont, +SetDrawColor, +SetFillColor, +SetTextColor, +SetLineWidth, +AddLink, +Ln, +MultiCell, +Write, +SetAutoPageBreak
Index
diff --git a/pdf/fpdf/doc/close.htm b/pdf/fpdf/doc/close.htm old mode 100755 new mode 100644 index 6d8c192..a4055ac --- a/pdf/fpdf/doc/close.htm +++ b/pdf/fpdf/doc/close.htm @@ -14,7 +14,7 @@ does it automatically.
If the document contains no page, AddPage() is called to prevent from getting an invalid document.

See also

-Output(). +Output
Index
diff --git a/pdf/fpdf/doc/error.htm b/pdf/fpdf/doc/error.htm old mode 100755 new mode 100644 index 49b6083..fbbc263 --- a/pdf/fpdf/doc/error.htm +++ b/pdf/fpdf/doc/error.htm @@ -9,9 +9,10 @@

Error

Error(string msg)

Description

-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.
+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.

Parameters

msg
diff --git a/pdf/fpdf/doc/footer.htm b/pdf/fpdf/doc/footer.htm old mode 100755 new mode 100644 index 1e4b3ad..bee81cf --- a/pdf/fpdf/doc/footer.htm +++ b/pdf/fpdf/doc/footer.htm @@ -28,7 +28,7 @@ function Footer() }

See also

-Header(). +Header
Index
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 @@ + + + + +GetPageHeight + + + +

GetPageHeight

+float GetPageHeight() +

Description

+Returns the current page height. +

See also

+GetPageWidth +
+
Index
+ + 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 @@ + + + + +GetPageWidth + + + +

GetPageWidth

+float GetPageWidth() +

Description

+Returns the current page width. +

See also

+GetPageHeight +
+
Index
+ + diff --git a/pdf/fpdf/doc/getstringwidth.htm b/pdf/fpdf/doc/getstringwidth.htm old mode 100755 new mode 100644 diff --git a/pdf/fpdf/doc/getx.htm b/pdf/fpdf/doc/getx.htm old mode 100755 new mode 100644 index 1d1310c..4272502 --- a/pdf/fpdf/doc/getx.htm +++ b/pdf/fpdf/doc/getx.htm @@ -11,9 +11,9 @@

Description

Returns the abscissa of the current position.

See also

-SetX(), -GetY(), -SetY(). +SetX, +GetY, +SetY
Index
diff --git a/pdf/fpdf/doc/gety.htm b/pdf/fpdf/doc/gety.htm old mode 100755 new mode 100644 index e8ce6cf..fb84f5d --- a/pdf/fpdf/doc/gety.htm +++ b/pdf/fpdf/doc/gety.htm @@ -11,9 +11,9 @@

Description

Returns the ordinate of the current position.

See also

-SetY(), -GetX(), -SetX(). +SetY, +GetX, +SetX
Index
diff --git a/pdf/fpdf/doc/header.htm b/pdf/fpdf/doc/header.htm old mode 100755 new mode 100644 index b7cd1f8..0228159 --- a/pdf/fpdf/doc/header.htm +++ b/pdf/fpdf/doc/header.htm @@ -30,7 +30,7 @@ function Header() }

See also

-Footer(). +Footer
Index
diff --git a/pdf/fpdf/doc/image.htm b/pdf/fpdf/doc/image.htm old mode 100755 new mode 100644 index 66a35ee..53a4ec1 --- 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');

See also

-AddLink(). +AddLink
Index
diff --git a/pdf/fpdf/doc/index.htm b/pdf/fpdf/doc/index.htm old mode 100755 new mode 100644 index 6c27066..32ded00 --- a/pdf/fpdf/doc/index.htm +++ b/pdf/fpdf/doc/index.htm @@ -2,11 +2,12 @@ -FPDF 1.7 Reference Manual +FPDF 1.82 Reference Manual -

FPDF 1.7 Reference Manual

+

FPDF 1.82 Reference Manual

+__construct - constructor
AcceptPageBreak - accept or not automatic page break
AddFont - add a new font
AddLink - create an internal link
@@ -16,7 +17,8 @@ Close - terminate the document
Error - fatal error
Footer - page footer
-FPDF - constructor
+GetPageHeight - get current page height
+GetPageWidth - get current page width
GetStringWidth - compute string length
GetX - get current x position
GetY - get current y position
@@ -50,7 +52,7 @@ SetTopMargin - set top margin
SetX - set current x position
SetXY - set current x and y positions
-SetY - set current y position
+SetY - set current y position and optionally reset x
Text - print a string
Write - print flowing text
diff --git a/pdf/fpdf/doc/line.htm b/pdf/fpdf/doc/line.htm old mode 100755 new mode 100644 index a9c5194..f6b70f0 --- a/pdf/fpdf/doc/line.htm +++ b/pdf/fpdf/doc/line.htm @@ -30,8 +30,8 @@ Ordinate of second point.

See also

-SetLineWidth(), -SetDrawColor(). +SetLineWidth, +SetDrawColor
Index
diff --git a/pdf/fpdf/doc/link.htm b/pdf/fpdf/doc/link.htm old mode 100755 new mode 100644 index d6c728c..c8fd1cb --- a/pdf/fpdf/doc/link.htm +++ b/pdf/fpdf/doc/link.htm @@ -36,10 +36,10 @@ URL or identifier returned by AddLink().

See also

-AddLink(), -Cell(), -Write(), -Image(). +AddLink, +Cell, +Write, +Image
Index
diff --git a/pdf/fpdf/doc/ln.htm b/pdf/fpdf/doc/ln.htm old mode 100755 new mode 100644 index 0b91b00..0183738 --- 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.

See also

-Cell(). +Cell
Index
diff --git a/pdf/fpdf/doc/multicell.htm b/pdf/fpdf/doc/multicell.htm old mode 100755 new mode 100644 index c41bbd7..ce1e4e6 --- a/pdf/fpdf/doc/multicell.htm +++ b/pdf/fpdf/doc/multicell.htm @@ -62,14 +62,14 @@ Default value: false.

See also

-SetFont(), -SetDrawColor(), -SetFillColor(), -SetTextColor(), -SetLineWidth(), -Cell(), -Write(), -SetAutoPageBreak(). +SetFont, +SetDrawColor, +SetFillColor, +SetTextColor, +SetLineWidth, +Cell, +Write, +SetAutoPageBreak
Index
diff --git a/pdf/fpdf/doc/output.htm b/pdf/fpdf/doc/output.htm old mode 100755 new mode 100644 index b62291c..9a905a8 --- a/pdf/fpdf/doc/output.htm +++ b/pdf/fpdf/doc/output.htm @@ -7,35 +7,39 @@

Output

-string Output([string name, string dest]) +string Output([string dest [, string name [, boolean isUTF8]]])

Description

-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.
The method first calls Close() if necessary to terminate the document.

Parameters

-
name
-
-The name of the file. If not specified, the document will be sent to the browser -(destination I) with the name doc.pdf. -
dest
-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: +The default value is I. +
+
name
+
+The name of the file. It is ignored in case of destination S.
+The default value is doc.pdf. +
+
isUTF8
+
+Indicates if name is encoded in ISO-8859-1 (false) or UTF-8 (true). +Only used for destinations I and D.
+The default value is false.

See also

-Close(). +Close
Index
diff --git a/pdf/fpdf/doc/pageno.htm b/pdf/fpdf/doc/pageno.htm old mode 100755 new mode 100644 index 84e0f22..42063c7 --- a/pdf/fpdf/doc/pageno.htm +++ b/pdf/fpdf/doc/pageno.htm @@ -11,7 +11,7 @@

Description

Returns the current page number.

See also

-AliasNbPages(). +AliasNbPages
Index
diff --git a/pdf/fpdf/doc/rect.htm b/pdf/fpdf/doc/rect.htm old mode 100755 new mode 100644 index fa71375..0b73acc --- a/pdf/fpdf/doc/rect.htm +++ b/pdf/fpdf/doc/rect.htm @@ -39,9 +39,9 @@ Style of rendering. Possible values are:

See also

-SetLineWidth(), -SetDrawColor(), -SetFillColor(). +SetLineWidth, +SetDrawColor, +SetFillColor
Index
diff --git a/pdf/fpdf/doc/setauthor.htm b/pdf/fpdf/doc/setauthor.htm old mode 100755 new mode 100644 index 60d3b7c..31a0458 --- a/pdf/fpdf/doc/setauthor.htm +++ b/pdf/fpdf/doc/setauthor.htm @@ -23,10 +23,10 @@ Default value: false.

See also

-SetCreator(), -SetKeywords(), -SetSubject(), -SetTitle(). +SetCreator, +SetKeywords, +SetSubject, +SetTitle
Index
diff --git a/pdf/fpdf/doc/setautopagebreak.htm b/pdf/fpdf/doc/setautopagebreak.htm old mode 100755 new mode 100644 index 71dec89..c8881bf --- a/pdf/fpdf/doc/setautopagebreak.htm +++ b/pdf/fpdf/doc/setautopagebreak.htm @@ -24,9 +24,9 @@ Distance from the bottom of the page.

See also

-Cell(), -MultiCell(), -AcceptPageBreak(). +Cell, +MultiCell, +AcceptPageBreak
Index
diff --git a/pdf/fpdf/doc/setcompression.htm b/pdf/fpdf/doc/setcompression.htm old mode 100755 new mode 100644 diff --git a/pdf/fpdf/doc/setcreator.htm b/pdf/fpdf/doc/setcreator.htm old mode 100755 new mode 100644 index 2c0db3c..ce3bcad --- a/pdf/fpdf/doc/setcreator.htm +++ b/pdf/fpdf/doc/setcreator.htm @@ -24,10 +24,10 @@ Default value: false.

See also

-SetAuthor(), -SetKeywords(), -SetSubject(), -SetTitle(). +SetAuthor, +SetKeywords, +SetSubject, +SetTitle
Index
diff --git a/pdf/fpdf/doc/setdisplaymode.htm b/pdf/fpdf/doc/setdisplaymode.htm old mode 100755 new mode 100644 diff --git a/pdf/fpdf/doc/setdrawcolor.htm b/pdf/fpdf/doc/setdrawcolor.htm old mode 100755 new mode 100644 index 6be79c5..f77af0b --- a/pdf/fpdf/doc/setdrawcolor.htm +++ b/pdf/fpdf/doc/setdrawcolor.htm @@ -29,12 +29,12 @@ Blue component (between 0 and 255).

See also

-SetFillColor(), -SetTextColor(), -Line(), -Rect(), -Cell(), -MultiCell(). +SetFillColor, +SetTextColor, +Line, +Rect, +Cell, +MultiCell
Index
diff --git a/pdf/fpdf/doc/setfillcolor.htm b/pdf/fpdf/doc/setfillcolor.htm old mode 100755 new mode 100644 index 64f66d3..243a432 --- a/pdf/fpdf/doc/setfillcolor.htm +++ b/pdf/fpdf/doc/setfillcolor.htm @@ -29,11 +29,11 @@ Blue component (between 0 and 255).

See also

-SetDrawColor(), -SetTextColor(), -Rect(), -Cell(), -MultiCell(). +SetDrawColor, +SetTextColor, +Rect, +Cell, +MultiCell
Index
diff --git a/pdf/fpdf/doc/setfont.htm b/pdf/fpdf/doc/setfont.htm old mode 100755 new mode 100644 index 1cbae91..cd5a3b8 --- a/pdf/fpdf/doc/setfont.htm +++ b/pdf/fpdf/doc/setfont.htm @@ -81,11 +81,11 @@ $pdf->SetFont(''); $pdf->SetFont('Times','BIU');

See also

-AddFont(), -SetFontSize(), -Cell(), -MultiCell(), -Write(). +AddFont, +SetFontSize, +Cell, +MultiCell, +Write
Index
diff --git a/pdf/fpdf/doc/setfontsize.htm b/pdf/fpdf/doc/setfontsize.htm old mode 100755 new mode 100644 index 20b35cd..5bb9c39 --- a/pdf/fpdf/doc/setfontsize.htm +++ b/pdf/fpdf/doc/setfontsize.htm @@ -18,7 +18,7 @@ The size (in points).

See also

-SetFont(). +SetFont
Index
diff --git a/pdf/fpdf/doc/setkeywords.htm b/pdf/fpdf/doc/setkeywords.htm old mode 100755 new mode 100644 index 8b8897e..2b095fb --- a/pdf/fpdf/doc/setkeywords.htm +++ b/pdf/fpdf/doc/setkeywords.htm @@ -23,10 +23,10 @@ Default value: false.

See also

-SetAuthor(), -SetCreator(), -SetSubject(), -SetTitle(). +SetAuthor, +SetCreator, +SetSubject, +SetTitle
Index
diff --git a/pdf/fpdf/doc/setleftmargin.htm b/pdf/fpdf/doc/setleftmargin.htm old mode 100755 new mode 100644 index dde7a7c..f071372 --- a/pdf/fpdf/doc/setleftmargin.htm +++ b/pdf/fpdf/doc/setleftmargin.htm @@ -20,10 +20,10 @@ The margin.

See also

-SetTopMargin(), -SetRightMargin(), -SetAutoPageBreak(), -SetMargins(). +SetTopMargin, +SetRightMargin, +SetAutoPageBreak, +SetMargins
Index
diff --git a/pdf/fpdf/doc/setlinewidth.htm b/pdf/fpdf/doc/setlinewidth.htm old mode 100755 new mode 100644 index 11e417c..6267230 --- a/pdf/fpdf/doc/setlinewidth.htm +++ b/pdf/fpdf/doc/setlinewidth.htm @@ -19,10 +19,10 @@ The width.

See also

-Line(), -Rect(), -Cell(), -MultiCell(). +Line, +Rect, +Cell, +MultiCell
Index
diff --git a/pdf/fpdf/doc/setlink.htm b/pdf/fpdf/doc/setlink.htm old mode 100755 new mode 100644 index b524525..6767948 --- a/pdf/fpdf/doc/setlink.htm +++ b/pdf/fpdf/doc/setlink.htm @@ -27,7 +27,7 @@ Number of target page; -1 indicates the current page. This is the d

See also

-AddLink(). +AddLink
Index
diff --git a/pdf/fpdf/doc/setmargins.htm b/pdf/fpdf/doc/setmargins.htm old mode 100755 new mode 100644 index 7cc8c6d..7dff53b --- a/pdf/fpdf/doc/setmargins.htm +++ b/pdf/fpdf/doc/setmargins.htm @@ -27,10 +27,10 @@ Right margin. Default value is the left one.

See also

-SetLeftMargin(), -SetTopMargin(), -SetRightMargin(), -SetAutoPageBreak(). +SetLeftMargin, +SetTopMargin, +SetRightMargin, +SetAutoPageBreak
Index
diff --git a/pdf/fpdf/doc/setrightmargin.htm b/pdf/fpdf/doc/setrightmargin.htm old mode 100755 new mode 100644 index 7915647..e362caa --- a/pdf/fpdf/doc/setrightmargin.htm +++ b/pdf/fpdf/doc/setrightmargin.htm @@ -18,10 +18,10 @@ The margin.

See also

-SetLeftMargin(), -SetTopMargin(), -SetAutoPageBreak(), -SetMargins(). +SetLeftMargin, +SetTopMargin, +SetAutoPageBreak, +SetMargins
Index
diff --git a/pdf/fpdf/doc/setsubject.htm b/pdf/fpdf/doc/setsubject.htm old mode 100755 new mode 100644 index e8c628c..a0e5be5 --- a/pdf/fpdf/doc/setsubject.htm +++ b/pdf/fpdf/doc/setsubject.htm @@ -23,10 +23,10 @@ Default value: false.

See also

-SetAuthor(), -SetCreator(), -SetKeywords(), -SetTitle(). +SetAuthor, +SetCreator, +SetKeywords, +SetTitle
Index
diff --git a/pdf/fpdf/doc/settextcolor.htm b/pdf/fpdf/doc/settextcolor.htm old mode 100755 new mode 100644 index cb12fec..88dc0d3 --- a/pdf/fpdf/doc/settextcolor.htm +++ b/pdf/fpdf/doc/settextcolor.htm @@ -29,11 +29,11 @@ Blue component (between 0 and 255).

See also

-SetDrawColor(), -SetFillColor(), -Text(), -Cell(), -MultiCell(). +SetDrawColor, +SetFillColor, +Text, +Cell, +MultiCell
Index
diff --git a/pdf/fpdf/doc/settitle.htm b/pdf/fpdf/doc/settitle.htm old mode 100755 new mode 100644 index 3bc0fe8..977646b --- a/pdf/fpdf/doc/settitle.htm +++ b/pdf/fpdf/doc/settitle.htm @@ -23,10 +23,10 @@ Default value: false.

See also

-SetAuthor(), -SetCreator(), -SetKeywords(), -SetSubject(). +SetAuthor, +SetCreator, +SetKeywords, +SetSubject
Index
diff --git a/pdf/fpdf/doc/settopmargin.htm b/pdf/fpdf/doc/settopmargin.htm old mode 100755 new mode 100644 index 65a4b7d..4d94e76 --- a/pdf/fpdf/doc/settopmargin.htm +++ b/pdf/fpdf/doc/settopmargin.htm @@ -18,10 +18,10 @@ The margin.

See also

-SetLeftMargin(), -SetRightMargin(), -SetAutoPageBreak(), -SetMargins(). +SetLeftMargin, +SetRightMargin, +SetAutoPageBreak, +SetMargins
Index
diff --git a/pdf/fpdf/doc/setx.htm b/pdf/fpdf/doc/setx.htm old mode 100755 new mode 100644 index 7c92465..76eec7c --- a/pdf/fpdf/doc/setx.htm +++ b/pdf/fpdf/doc/setx.htm @@ -19,10 +19,10 @@ The value of the abscissa.

See also

-GetX(), -GetY(), -SetY(), -SetXY(). +GetX, +GetY, +SetY, +SetXY
Index
diff --git a/pdf/fpdf/doc/setxy.htm b/pdf/fpdf/doc/setxy.htm old mode 100755 new mode 100644 index c0602e5..57b83c2 --- a/pdf/fpdf/doc/setxy.htm +++ b/pdf/fpdf/doc/setxy.htm @@ -23,8 +23,8 @@ The value of the ordinate.

See also

-SetX(), -SetY(). +SetX, +SetY
Index
diff --git a/pdf/fpdf/doc/sety.htm b/pdf/fpdf/doc/sety.htm old mode 100755 new mode 100644 index e9afe11..f970685 --- a/pdf/fpdf/doc/sety.htm +++ b/pdf/fpdf/doc/sety.htm @@ -7,9 +7,9 @@

SetY

-SetY(float y) +SetY(float y [, boolean resetX])

Description

-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.

Parameters

@@ -17,12 +17,16 @@ is negative, it is relative to the bottom of the page.
The value of the ordinate.
+
resetX
+
+Whether to reset the abscissa. Default value: true. +

See also

-GetX(), -GetY(), -SetX(), -SetXY(). +GetX, +GetY, +SetX, +SetXY
Index
diff --git a/pdf/fpdf/doc/text.htm b/pdf/fpdf/doc/text.htm old mode 100755 new mode 100644 index ccd86eb..25f69b3 --- a/pdf/fpdf/doc/text.htm +++ b/pdf/fpdf/doc/text.htm @@ -28,11 +28,11 @@ String to print.

See also

-SetFont(), -SetTextColor(), -Cell(), -MultiCell(), -Write(). +SetFont, +SetTextColor, +Cell, +MultiCell, +Write
Index
diff --git a/pdf/fpdf/doc/write.htm b/pdf/fpdf/doc/write.htm old mode 100755 new mode 100644 index 162476b..bd85401 --- 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');

See also

-SetFont(), -SetTextColor(), -AddLink(), -MultiCell(), -SetAutoPageBreak(). +SetFont, +SetTextColor, +AddLink, +MultiCell, +SetAutoPageBreak
Index
diff --git a/pdf/fpdf/font/courier.php b/pdf/fpdf/font/courier.php old mode 100755 new mode 100644 index 213bf35..67dbeda --- 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 old mode 100755 new mode 100644 index 3fc69a5..62550a4 --- 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 old mode 100755 new mode 100644 index a49f2ae..6a3ecc6 --- 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 old mode 100755 new mode 100644 index 9c1c2cf..b88e098 --- 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 old mode 100755 new mode 100644 index 7e20c3a..2be3eca --- 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 old mode 100755 new mode 100644 index 452e0ac..c88394c --- 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 old mode 100755 new mode 100644 index ea5c56f..bcea807 --- 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 old mode 100755 new mode 100644 index e3c638a..a328b04 --- 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 old mode 100755 new mode 100644 index b980b07..5b9147b --- 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 old mode 100755 new mode 100644 index d3ea808..f78850f --- 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 old mode 100755 new mode 100644 index 1c198f0..0516750 --- 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 old mode 100755 new mode 100644 index a6034b2..32fe25e --- 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 old mode 100755 new mode 100644 index bd9e0d9..b0e5a62 --- 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 old mode 100755 new mode 100644 index afef4d3..b9d0309 --- 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 old mode 100755 new mode 100644 index 5db3377..dd2c540 --- 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 old mode 100755 new mode 100644 index 86152ec..eb64d15 --- 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('FPDF error: '.$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('<_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('<_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 .= '<_textstring($pl[4]).'>>>>'; + else { - $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); - $annots .= '<_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 <>'); - $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('<_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 <>'); + $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('<PageInfo[$n]['n'].' 0 R '; + $this->_put($kids.']'); + $this->_put('/Count '.$nb); + if($this->DefOrientation=='P') { - // Encodings - $this->_newobj(); - $this->_out('<>'); - $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('<_put('<_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('<>'); + $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('<_out('/BaseFont /'.$name); - $this->_out('/Subtype /Type1'); + $this->_put('<_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('<_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('<_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 = '<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 .= "<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('<_out('/Subtype /Image'); - $this->_out('/Width '.$info['w']); - $this->_out('/Height '.$info['h']); + $this->_put('<_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_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 old mode 100755 new mode 100644 diff --git a/pdf/fpdf/license.txt b/pdf/fpdf/license.txt old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1250.map b/pdf/fpdf/makefont/cp1250.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1251.map b/pdf/fpdf/makefont/cp1251.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1252.map b/pdf/fpdf/makefont/cp1252.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1253.map b/pdf/fpdf/makefont/cp1253.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1254.map b/pdf/fpdf/makefont/cp1254.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1255.map b/pdf/fpdf/makefont/cp1255.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1257.map b/pdf/fpdf/makefont/cp1257.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp1258.map b/pdf/fpdf/makefont/cp1258.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/cp874.map b/pdf/fpdf/makefont/cp874.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-1.map b/pdf/fpdf/makefont/iso-8859-1.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-11.map b/pdf/fpdf/makefont/iso-8859-11.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-15.map b/pdf/fpdf/makefont/iso-8859-15.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-16.map b/pdf/fpdf/makefont/iso-8859-16.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-2.map b/pdf/fpdf/makefont/iso-8859-2.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-4.map b/pdf/fpdf/makefont/iso-8859-4.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-5.map b/pdf/fpdf/makefont/iso-8859-5.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-7.map b/pdf/fpdf/makefont/iso-8859-7.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/iso-8859-9.map b/pdf/fpdf/makefont/iso-8859-9.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/koi8-r.map b/pdf/fpdf/makefont/koi8-r.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/koi8-u.map b/pdf/fpdf/makefont/koi8-u.map old mode 100755 new mode 100644 diff --git a/pdf/fpdf/makefont/makefont.php b/pdf/fpdf/makefont/makefont.php old mode 100755 new mode 100644 index 78db0aa..fbe8dcf --- 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 = "\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 old mode 100755 new mode 100644 index 602a543..e6ba321 --- a/pdf/fpdf/makefont/ttfparser.php +++ b/pdf/fpdf/makefont/ttfparser.php @@ -1,39 +1,67 @@ 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$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("Error: $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 old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/20k_c2.txt b/pdf/fpdf/tutorial/20k_c2.txt old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/calligra.php b/pdf/fpdf/tutorial/calligra.php old mode 100755 new mode 100644 index baf8a3a..e262f4c --- 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 old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/calligra.z b/pdf/fpdf/tutorial/calligra.z old mode 100755 new mode 100644 index 1c0bebd..8a14e9c Binary files a/pdf/fpdf/tutorial/calligra.z and b/pdf/fpdf/tutorial/calligra.z differ diff --git a/pdf/fpdf/tutorial/countries.txt b/pdf/fpdf/tutorial/countries.txt old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/index.htm b/pdf/fpdf/tutorial/index.htm old mode 100755 new mode 100644 index 44dba25..87cc484 --- a/pdf/fpdf/tutorial/index.htm +++ b/pdf/fpdf/tutorial/index.htm @@ -14,7 +14,7 @@
  • Tutorial 4: Multi-columns
  • Tutorial 5: Tables
  • Tutorial 6: Links and flowing text
  • -
  • Tutorial 7: Adding new fonts and encoding support
  • - +
  • Tutorial 7: Adding new fonts and encodings
  • + diff --git a/pdf/fpdf/tutorial/logo.png b/pdf/fpdf/tutorial/logo.png old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/makefont.php b/pdf/fpdf/tutorial/makefont.php old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto1.htm b/pdf/fpdf/tutorial/tuto1.htm old mode 100755 new mode 100644 index a26e29a..36fabad --- a/pdf/fpdf/tutorial/tuto1.htm +++ b/pdf/fpdf/tutorial/tuto1.htm @@ -21,7 +21,7 @@ Let's start with the classic example:

    [Demo]

    After including the library file, we create an FPDF object. -The FPDF() constructor is used here with the default values: pages are in A4 portrait and +The constructor 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:
    $pdf = new FPDF('P','mm','A4');
    @@ -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 SetMargins().
     

    -Before we can print text, it's mandatory to select a font with SetFont(), otherwise the -document would be invalid. We choose Arial bold 16: +Before we can print text, it's mandatory to select a font with SetFont(). +We choose Arial bold 16:
    $pdf->SetFont('Arial','B',16);
     
    @@ -65,7 +65,7 @@ the height of the break.

    Finally, the document is closed and sent to the browser with Output(). We could have saved -it to a file by passing the desired file name. +it to a file by passing the appropriate parameters.

    Caution: 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 old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto2.htm b/pdf/fpdf/tutorial/tuto2.htm old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto2.php b/pdf/fpdf/tutorial/tuto2.php old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto3.htm b/pdf/fpdf/tutorial/tuto3.htm old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto3.php b/pdf/fpdf/tutorial/tuto3.php old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto4.htm b/pdf/fpdf/tutorial/tuto4.htm old mode 100755 new mode 100644 index c4a4eb8..7af730f --- a/pdf/fpdf/tutorial/tuto4.htm +++ b/pdf/fpdf/tutorial/tuto4.htm @@ -15,12 +15,10 @@ columns. 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() +function Header() { // Page header global $title; diff --git a/pdf/fpdf/tutorial/tuto4.php b/pdf/fpdf/tutorial/tuto4.php old mode 100755 new mode 100644 index 360d237..f5f4fa8 --- 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 old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto5.php b/pdf/fpdf/tutorial/tuto5.php old mode 100755 new mode 100644 diff --git a/pdf/fpdf/tutorial/tuto6.htm b/pdf/fpdf/tutorial/tuto6.htm old mode 100755 new mode 100644 index 2b98d20..24516e6 --- 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 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/tuto6.php b/pdf/fpdf/tutorial/tuto6.php old mode 100755 new mode 100644 index 88fdd51..66580e9 --- 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 old mode 100755 new mode 100644 index 21a3f6e..b42e552 --- a/pdf/fpdf/tutorial/tuto7.htm +++ b/pdf/fpdf/tutorial/tuto7.htm @@ -2,32 +2,18 @@ -Adding new fonts and encoding support +Adding new fonts and encodings - -

    Adding new fonts and encoding support

    -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). +

    Adding new fonts and encodings

    +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).

    -Remark: for OpenType, only the format based on TrueType is supported (not the one based on Type1). -
    -
    -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).
    +For Type1, you will need the corresponding AFM file (it is usually provided with the font).

    Adding a new font requires two steps: @@ -35,7 +21,6 @@ Adding a new font requires two steps:
  • Generation of the font definition file
  • Declaration of the font in the script
  • -For Type1, you need the corresponding AFM file. It's usually provided with the font.

    Generation of the font definition file

    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:

    -MakeFont(string fontfile, [, string enc [, boolean embed]]) +MakeFont(string fontfile [, string enc [, boolean embed [, boolean subset]]])
    fontfile
    @@ -57,6 +42,10 @@ directory of the package: makefont.php. It contains the following function:

    Whether to embed the font or not. Default value: true.

    +
    subset
    +
    +

    Whether to subset the font or not. Default value: true.

    +
    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:
  • KOI8-R (Russian)
  • KOI8-U (Ukrainian)
  • -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.

    -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. +
    +
    +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.

    After you have called the function (create a new file for this and include makefont.php), a .php file @@ -109,7 +107,7 @@ Example:
    <?php
     require('makefont/makefont.php');
     
    -MakeFont('c:\\Windows\\Fonts\\comic.ttf','cp1252');
    +MakeFont('C:\\Windows\\Fonts\\comic.ttf','cp1252');
     ?>
    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:

    -php makefont\makefont.php c:\Windows\Fonts\comic.ttf cp1252 +php makefont\makefont.php C:\Windows\Fonts\comic.ttf cp1252

    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
    ?>

    [Demo]

    - -

    About the euro symbol

    -The euro character is not present in all encodings, and is not always placed at the same position: - - - - - - - - - - - - - - - - - - - - - - -
    EncodingPosition
    cp1250128
    cp1251136
    cp1252128
    cp1253128
    cp1254128
    cp1255128
    cp1257128
    cp1258128
    cp874128
    ISO-8859-1N/A
    ISO-8859-2N/A
    ISO-8859-4N/A
    ISO-8859-5N/A
    ISO-8859-7N/A
    ISO-8859-9N/A
    ISO-8859-11N/A
    ISO-8859-15164
    ISO-8859-16164
    KOI8-RN/A
    KOI8-UN/A
    -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. - -

    Reducing the size of TrueType fonts

    -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 ttf2pt1 (the Windows binary is -available here) while specifying the encoding -you are interested in; all other characters will be discarded. -
    -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: -
    -
    -ttf2pt1 -b -L cp1250.map c:\Windows\Fonts\arial.ttf arial -
    -
    -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. -
    -
    -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. diff --git a/pdf/fpdf/tutorial/tuto7.php b/pdf/fpdf/tutorial/tuto7.php old mode 100755 new mode 100644 -- cgit From 94f06e717ab414c3df505147f44642452bc27daf Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Wed, 7 Oct 2020 12:54:38 +0530 Subject: Update functions w.r.t fpdf version and update headers to download file --- pdf/cert_new.inc | 26 +++++++++++++++++--------- pdf/mentor_cert_pdf.inc | 28 ++++++++++++++++++---------- 2 files changed, 35 insertions(+), 19 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/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'); -- cgit