X7ROOT File Manager
Current Path:
/opt/alt/pdflib-lite/usr/share/doc/alt-pdflib-lite/examples/php
opt
/
alt
/
pdflib-lite
/
usr
/
share
/
doc
/
alt-pdflib-lite
/
examples
/
php
/
??
..
??
businesscard.php
(2.34 KB)
??
chartab.php
(2.71 KB)
??
examples.php5
??
hello.php
(1.18 KB)
??
image.php
(1.35 KB)
??
invoice.php
(5.19 KB)
??
pdfclock.php
(2.54 KB)
??
quickreference.php
(2.31 KB)
??
readme.txt
(369 B)
??
starter_3d.php
(2.27 KB)
??
starter_basic.php
(2.44 KB)
??
starter_block.php
(2.73 KB)
??
starter_color.php
(11.16 KB)
??
starter_graphics.php
(7.36 KB)
??
starter_image.php
(5.74 KB)
??
starter_layer.php
(3.83 KB)
??
starter_pcos.php
(3.75 KB)
??
starter_pdfa.php
(1.82 KB)
??
starter_pdfmerge.php
(1.92 KB)
??
starter_pdfx.php
(2.25 KB)
??
starter_pvf.php
(2.5 KB)
??
starter_table.php
(5.4 KB)
??
starter_tagged.php
(1.73 KB)
??
starter_textflow.php
(3.52 KB)
??
starter_textline.php
(7.18 KB)
??
starter_type3font.php
(2.44 KB)
??
starter_webform.php
(2.12 KB)
Editing: starter_block.php
<? /* $Id: starter_block.php,v 1.4.2.1 2008/05/09 10:11:54 rjs Exp $ * * Block starter: * Import a PDF page containing, and process all blocks. The blocks are * retrieved via pCOS, and the block filling functions are used to * visualize the blocks on the output page. A real-world application would * of course fill the blocks with data retrieved from some external data * source. * * required software: PPS 7 or above * required data: input PDF */ /* This is where the data files are. Adjust as necessary. */ $searchpath = "../data"; $infile = "boilerplate.pdf"; $outfilename = "starter_block.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"); if (PDF_begin_document($p, $outfilename, "") == 0) { die("Error: " . PDF_get_errmsg($p)); } PDF_set_info($p, "Creator", "PDFlib starter sample"); PDF_set_info($p, "Title", "starter_block"); /* Open a PDF containing blocks */ $indoc = PDF_open_pdi_document($p, $infile, ""); if ($indoc == 0) { die("Error: " . PDF_get_errmsg($p)); } /* Open the first $page */ $page = PDF_open_pdi_page($p, $indoc, 1, ""); if ($page == 0) { die("Error: " . PDF_get_errmsg($p)); } $width = PDF_pcos_get_number($p, $indoc, "pages[0]/width"); $height = PDF_pcos_get_number($p, $indoc, "pages[0]/height"); PDF_begin_page_ext($p, $width, $height, ""); /* Place the imported $page on the output $page */ PDF_fit_pdi_page($p, $page, 0, 0, ""); /* Query the number of blocks on the first page */ $blockcount = PDF_pcos_get_number($p, $indoc, "length:pages[0]/blocks"); if ($blockcount == 0) { die("Error: " . $infile . "does not contain any PDFlib blocks"); } /* Loop over all blocks on the $page */ for ($i = 0; $i < $blockcount; $i++) { /* Fetch the name and type of the $i-th block on the first page * (one of Text/Image/PDF) */ $blockname = PDF_pcos_get_string($p, $indoc, "pages[0]/blocks[" . $i . "]/Name"); $blocktype = PDF_pcos_get_string($p, $indoc, "pages[0]/blocks[" . $i . "]/Subtype"); /* Visualize all text blocks */ if ($blocktype == "Text") { $optlist = "fontname=Helvetica encoding=unicode " . "fillcolor={rgb 1 0 0} " . "bordercolor={gray 0} linewidth=0.25"; /* We simply use the $blockname as content */ if (PDF_fill_textblock($p, $page, $blockname, $blockname, $optlist) == 0) { print("Warning: " . PDF_get_errmsg($p)); } } } PDF_end_page_ext($p, ""); PDF_close_pdi_page($p, $page); PDF_end_document($p, ""); PDF_close_pdi_document($p, $indoc); PDF_delete($p); print "$outfilename generated"; ?>
Upload File
Create Folder