/home/lnzliplg/public_html/pdflib-lite.zip
PK �c�\'�n[+
+
7 usr/share/doc/alt-pdflib-lite/examples/php/pdfclock.phpnu �[��� <?php
/* $Id: pdfclock.php,v 1.13 2006/10/01 20:33:35 rjs Exp $
*
* A little PDFlib application to draw an analog clock.
*/
$RADIUS = 200.0;
$MARGIN = 20.0;
$p = PDF_new();
# This means we must check return values of load_font() etc.
PDF_set_parameter($p, "errorpolicy", "return");
/* This line is required to avoid problems on Japanese systems */
PDF_set_parameter($p, "hypertextencoding", "winansi");
/* open new PDF file; insert a file name to create the PDF on disk */
if (PDF_begin_document($p, "", "") == 0) {
die("Error: " . PDF_get_errmsg($p));
}
PDF_set_info($p, "Creator", "pdfclock.php");
PDF_set_info($p, "Author", "Rainer Schaaf");
PDF_set_info($p, "Title", "PDF clock (PHP)");
PDF_begin_page_ext($p, 2 * ($RADIUS + $MARGIN), 2 * ($RADIUS + $MARGIN), "");
PDF_translate($p, $RADIUS + $MARGIN, $RADIUS + $MARGIN);
PDF_setcolor($p, "fillstroke", "rgb", 0.0, 0.0, 1.0, 0.0);
PDF_save($p);
/* minute strokes */
PDF_setlinewidth($p, 2.0);
for ($alpha = 0; $alpha < 360; $alpha += 6) {
PDF_rotate($p, 6.0);
PDF_moveto($p, $RADIUS, 0.0);
PDF_lineto($p, $RADIUS-$MARGIN/3, 0.0);
PDF_stroke($p);
}
PDF_restore($p);
PDF_save($p);
/* 5 minute strokes */
PDF_setlinewidth($p, 3.0);
for ($alpha = 0; $alpha < 360; $alpha += 30) {
PDF_rotate($p, 30.0);
PDF_moveto($p, $RADIUS, 0.0);
PDF_lineto($p, $RADIUS-$MARGIN, 0.0);
PDF_stroke($p);
}
$ltime = getdate();
/* draw hour hand */
PDF_save($p);
PDF_rotate($p, -(($ltime['minutes']/60.0)+$ltime['hours']-3.0)*30.0);
PDF_moveto($p, -$RADIUS/10, -$RADIUS/20);
PDF_lineto($p, $RADIUS/2, 0.0);
PDF_lineto($p, -$RADIUS/10, $RADIUS/20);
PDF_closepath($p);
PDF_fill($p);
PDF_restore($p);
/* draw minute hand */
PDF_save($p);
PDF_rotate($p, -(($ltime['seconds']/60.0)+$ltime['minutes']-15.0)*6.0);
PDF_moveto($p, -$RADIUS/10, -$RADIUS/20);
PDF_lineto($p, $RADIUS * 0.8, 0.0);
PDF_lineto($p, -$RADIUS/10, $RADIUS/20);
PDF_closepath($p);
PDF_fill($p);
PDF_restore($p);
/* draw second hand */
PDF_setcolor($p, "fillstroke", "rgb", 1.0, 0.0, 0.0, 0.0);
PDF_setlinewidth($p, 2);
PDF_save($p);
PDF_rotate($p, -(($ltime['seconds'] - 15.0) * 6.0));
PDF_moveto($p, -$RADIUS/5, 0.0);
PDF_lineto($p, $RADIUS, 0.0);
PDF_stroke($p);
PDF_restore($p);
/* draw little circle at center */
PDF_circle($p, 0, 0, $RADIUS/30);
PDF_fill($p);
PDF_restore($p);
PDF_end_page_ext($p, "");
PDF_end_document($p, "");
$buf = PDF_get_buffer($p);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=pdfclock.pdf");
print $buf;
PDF_delete($p);
?>
PK �c�\�G��E E ; usr/share/doc/alt-pdflib-lite/examples/php/starter_pdfa.phpnu �[��� <?php
/* $Id: starter_pdfa.php,v 1.3 2006/10/01 20:33:35 rjs Exp $
*
* PDF/A starter:
* Create PDF/A-compliant output
*
* required software: PDFlib/PDFlib+PDI/PPS 7
* required data: font file, image file
*/
/* This is where the data files are. Adjust as necessary. */
$searchpath = "../data";
$imagefile = "nesrin.jpg";
$outfilename = "starter_pdfa.pdf";
$p = PDF_new();
# This means we must check return values of load_font() etc.
PDF_set_parameter($p, "errorpolicy", "return");
PDF_set_parameter($p, "SearchPath", $searchpath);
/* we use "utf8" as textformat, this allows to use unicode encoding */
PDF_set_parameter($p, "textformat", "utf8");
/* PDF/A-1a requires Tagged PDF */
if (PDF_begin_document($p, $outfilename, "pdfa=PDF/A-1b:2005") == 0) {
die("Error: " . PDF_get_errmsg($p));
}
/*
* We use sRGB as output intent since it allows the color
* spaces CIELab, ICC-based, grayscale, and RGB.
*
* If you need CMYK color you must use a CMYK output profile.
*/
PDF_load_iccprofile($p, "sRGB", "usage=outputintent");
PDF_set_info($p, "Creator", "PDFlib starter sample");
PDF_set_info($p, "Title", "starter_pdfa");
PDF_begin_page_ext($p, 595, 842, "");
/* $font embedding is required for PDF/A */
$font = PDF_load_font($p, "LuciduxSans-Oblique", "unicode", "embedding");
if ($font == 0) {
die("Error: " . PDF_get_errmsg($p));
}
PDF_setfont($p, $font, 24);
PDF_fit_textline($p, "PDF/A-1b:2005 starter", 50, 700, "");
/* We can use an RGB $image since we already supplied an
* output intent profile.
*/
$image = PDF_load_image($p, "auto", $imagefile, "");
if ($image == 0) {
die("Error: " . PDF_get_errmsg($p));
}
/* Place the $image at the bottom of the page */
PDF_fit_image($p, $image, 0.0, 0.0, "scale=0.5");
PDF_end_page_ext($p, "");
PDF_end_document($p, "");
PDF_delete($p);
print "$outfilename generated";
?>
PK �c�\��_d^ ^ ; usr/share/doc/alt-pdflib-lite/examples/php/businesscard.phpnu �[��� <?php
/* $Id: businesscard.php,v 1.20 2006/10/01 20:33:35 rjs Exp $
*
* PDFlib client: businesscard example in PHP
*/
$infile = "boilerplate.pdf";
/* This is where font/image/PDF input files live. Adjust as necessary.
*
* Note that this directory must also contain the LuciduxSans font outline
* and metrics files.
*/
$searchpath = "../data";
$data = array( "name" => "Victor Kraxi",
"business.title" => "Chief Paper Officer",
"business.address.line1" => "17, Aviation Road",
"business.address.city" => "Paperfield",
"business.telephone.voice" => "phone +1 234 567-89",
"business.telephone.fax" => "fax +1 234 567-98",
"business.email" => "victor@kraxi.com",
"business.homepage" => "www.kraxi.com"
);
$p = PDF_new();
# This means we must check return values of load_font() etc.
PDF_set_parameter($p, "errorpolicy", "return");
/* Set the search path for fonts and PDF files */
PDF_set_parameter($p, "SearchPath", $searchpath);
/* This line is required to avoid problems on Japanese systems */
PDF_set_parameter($p, "hypertextencoding", "winansi");
/* open new PDF file; insert a file name to create the PDF on disk */
if (PDF_begin_document($p, "", "") == 0) {
die("Error: " . PDF_get_errmsg($p));
}
PDF_set_info($p, "Creator", "businesscard.php");
PDF_set_info($p, "Author", "Thomas Merz");
PDF_set_info($p, "Title", "PDFlib block processing sample (PHP)");
$blockcontainer = PDF_open_pdi($p, $infile, "", 0);
if ($blockcontainer == 0) {
die ("Error: " . PDF_get_errmsg($p));
}
$page = PDF_open_pdi_page($p, $blockcontainer, 1, "");
if ($page == 0) {
die ("Error: " . PDF_get_errmsg($p));
}
PDF_begin_page_ext($p, 20, 20, ""); /* dummy page size */
/* This will adjust the page size to the block container's size. */
PDF_fit_pdi_page($p, $page, 0, 0, "adjustpage");
/* Fill all text blocks with dynamic data */
foreach ($data as $key => $value) {
if (PDF_fill_textblock($p, $page, $key, $value,
"embedding encoding=winansi") == 0) {
printf("Warning: %s\n ", PDF_get_errmsg($p));
}
}
PDF_end_page_ext($p, "");
PDF_close_pdi_page($p, $page);
PDF_end_document($p, "");
PDF_close_pdi($p, $blockcontainer);
$buf = PDF_get_buffer($p);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=businesscard.pdf");
print $buf;
PDF_delete($p);
?>
PK �c�\�#��� � = usr/share/doc/alt-pdflib-lite/examples/php/starter_tagged.phpnu �[��� <?php
/* $Id: starter_tagged.php,v 1.4.2.1 2008/01/11 11:32:35 kurt Exp $
*
* Tagged PDF starter:
* Create document with structure information for reflow and accessibility
*
* required software: PDFlib/PDFlib+PDI/PPS 7
* required data: none (dummy text created in program)
*/
/* This is where the data files are. Adjust as necessary. */
$searchpath = "../data";
$outfilename = "starter_tagged.pdf";
$p = PDF_new();
# This means we must check return values of load_font() etc.
PDF_set_parameter($p, "errorpolicy", "return");
PDF_set_parameter($p, "SearchPath", $searchpath);
if (PDF_begin_document($p, $outfilename, "tagged=true") == 0) {
die("Error: " . PDF_get_errmsg($p));
}
PDF_set_info($p, "Creator", "PDFlib starter sample");
PDF_set_info($p, "Title", "starter_tagged");
/* Automatically create spaces between chunks of text */
PDF_set_parameter($p, "autospace", "true");
/* open the first structure element as a child of the document
* structure root (=0)
*/
$id = PDF_begin_item($p, "P", "Title = {Simple Paragraph}");
PDF_begin_page_ext($p, 0, 0, "width=a4.width height=a4.height");
$font = PDF_load_font($p, "Helvetica", "winansi", "");
if ($font == 0) {
die("Error: " . PDF_get_errmsg($p));
}
PDF_setfont($p, $font, 24.0);
PDF_show_xy($p, "Hello, Tagged PDF!", 50, 700);
PDF_continue_text($p, "This PDF has a very simple");
PDF_continue_text($p, "document structure.");
PDF_end_item($p, $id);
/* The page number is created as an artifact; it will be
* ignored when reflowing the page in Acrobat.
*/
$id_artifact = PDF_begin_item($p, "Artifact", "");
PDF_show_xy($p, "Page 1", 250, 100);
PDF_end_item($p, $id_artifact);
PDF_end_page_ext($p, "");
PDF_end_document($p, "");
PDF_delete($p);
print "$outfilename generated";
?>
PK �c�\�|�Y�, �, <