|
|
LXXXVIII. pdf 関数
PHPのPDF関数は、により作成されたPDFlibライブラリを使用してPDFファイル
を作成することが可能です。
本節のドキュメントは、PDFlibライブラリで利用可能な関数の概要のみ
を説明することを意図しています。ここで扱う各関すの完全で詳細な説
明については、PDFlibのソース配布ファイルと共に配布されているドキュ
メントを参照下さい。このドキュメントは、PDFlib の機能に関
する概要を非常に良くまとめており、全ての関数に関する最新のドキュ
メントが含まれています。
PDFlibのほとんどの関数とPHPモジュール内の関数の名前とパラメータは
共通になっています。このモジュールを効率的に使用するには、PDFまた
はPostScriptに関する基本的な考え方も理解しておく必要があります。
全ての長さと座標は、Postscriptのポイント数で計られます。通常、1イ
ンチ当たり72 Postscript ポイントですが、これは、出力解像度に依存
します。使用する座表系に関するより詳細な説明については、PDFlibの
ソース配布に含まれるPDFlibドキュメントを参照下さい。
ほとんど全てのPDF関数は、最初の引数パラメータとして
pdf object を必要とすることに注意して下さ
い。より詳細な情報については以下の例を参照下さい。
PDFlibは、 でダウンロード
可能ですが、商用で使用する場合はライセンスを購入する必要がありま
す。この拡張モジュールをコンパイルするには、および が必要です。
2000年3月9日以降のバージョンのPHPでは、3.0より古いバージョンの
PDFlibをサポートしていません。
PDFlib 3.0以降が、PHP 3.0.19以降でサポートされています。
以下の関数が動作するようにするには、
--with-pdflib[=DIR]を指定してPHPを
コンパイルする必要があります。DIRはPDFlibのベースインストールディレ
クトリで、デフォルトは/usr/localです。
さらに、PDFlibでjpeg, tiff, pngライブラリを使用することを指定できま
す。これは、PDFlib 4.xではオプションです。
これを行うには、configureにオプション
--with-jpeg-dir[=DIR]
--with-png-dir[=DIR]
--with-tiff-dir[=DIR]を追加します。
バージョン3.xのPDFlibを使用する場合、PDFlibのconfigureのオプションに
--enable-shared-pdflibを指定する必要があります。
この拡張モジュールは設定ディレクティブを全く定義しません。
PHP v4.0.5以降、PHPlib用のPHP拡張モジュールは、PDFlib GmbH から正
式にサポートされています。これにより、PDFlibマニュアル(バージョン
3.00以降)に記述された全ての関数がPHP4で全く同じ意味、同じパラメー
タでサポートされています。返り値のみは、エラーの場合に
FALSEを返すというPHPの流儀に合わせるために
PDFlibマニュアルと異なっていることがあります。互換性を保つために
PDFlibサポート関数ではまだ古い関数もサポートしていますが、上記の
ように新しいバージョンに置換される予定です。PDFlib GmbH は、これら
の古い関数を使用した場合に生じた際に生じた問題に関してはサポートを
行いません。
多くの関数の使用法は簡単です。最も困難なのは、非常に簡単なpdfドキュ
メントを作成する場合でしょう。次の例は、入門の際の助けとなるはず
です。この例では、1ページを有するファイル
test.pdfが作成されます。このページには、30ポ
イントのアウトラインフォントでテキスト"Times-Roman outlined"が描
かれます。このテキストには、下線も引かれます。
例 1. PDFlibでPDFドキュメントを作成する
<?php
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
pdf_set_font($pdf, "Times-Roman", 30, "host");
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
echo "<A HREF=getpdf.php>完了しました</A>";
?>
|
以下のスクリプトgetpdf.phpは、PDFドキュメ
ントを返すだけのものです。
|
PDFlibの配布ファイルには、アナログクロックで本格的なページを作成す
るより複雑な例が含まれています。ここでは、PDFlibのメモリ内作成機
能を使用しており、このため、テンポラリファイルは不要です。この例
をPHPからPDFlibを使用するように変換すると以下のようになります。
(CLibPDFモジュール)のドキュメント
にも同じ例があります。)
例 2. PDFlib配布ファイル中の pdfclockの例 <?php
$radius = 200;
$margin = 20;
$pagecount = 10;
$pdf = pdf_new();
if (!pdf_open_file($pdf, "")) {
print error;
exit;
};
pdf_set_parameter($pdf, "warning", "true");
pdf_set_info($pdf, "Creator", "pdf_clock.php");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Analog Clock");
while($pagecount-- > 0) {
pdf_begin_page($pdf, 2 * ($radius + $margin), 2 * ($radius + $margin));
pdf_set_parameter($pdf, "transition", "wipe");
pdf_set_value($pdf, "duration", 0.5);
pdf_translate($pdf, $radius + $margin, $radius + $margin);
pdf_save($pdf);
pdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);
/* 1分刻みの目盛 */
pdf_setlinewidth($pdf, 2.0);
for ($alpha = 0; $alpha < 360; $alpha += 6) {
pdf_rotate($pdf, 6.0);
pdf_moveto($pdf, $radius, 0.0);
pdf_lineto($pdf, $radius-$margin/3, 0.0);
pdf_stroke($pdf);
}
pdf_restore($pdf);
pdf_save($pdf);
/* 5分刻みの目盛 */
pdf_setlinewidth($pdf, 3.0);
for ($alpha = 0; $alpha < 360; $alpha += 30) {
pdf_rotate($pdf, 30.0);
pdf_moveto($pdf, $radius, 0.0);
pdf_lineto($pdf, $radius-$margin, 0.0);
pdf_stroke($pdf);
}
$ltime = getdate();
/* 時針を描画 */
pdf_save($pdf);
pdf_rotate($pdf,-(($ltime['minutes']/60.0)+$ltime['hours']-3.0)*30.0);
pdf_moveto($pdf, -$radius/10, -$radius/20);
pdf_lineto($pdf, $radius/2, 0.0);
pdf_lineto($pdf, -$radius/10, $radius/20);
pdf_closepath($pdf);
pdf_fill($pdf);
pdf_restore($pdf);
/* 分針を描画 */
pdf_save($pdf);
pdf_rotate($pdf,-(($ltime['seconds']/60.0)+$ltime['minutes']-15.0)*6.0);
pdf_moveto($pdf, -$radius/10, -$radius/20);
pdf_lineto($pdf, $radius * 0.8, 0.0);
pdf_lineto($pdf, -$radius/10, $radius/20);
pdf_closepath($pdf);
pdf_fill($pdf);
pdf_restore($pdf);
/* 秒針を描画 */
pdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
pdf_setlinewidth($pdf, 2);
pdf_save($pdf);
pdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
pdf_moveto($pdf, -$radius/5, 0.0);
pdf_lineto($pdf, $radius, 0.0);
pdf_stroke($pdf);
pdf_restore($pdf);
/* 中心に小さな円を描画 */
pdf_circle($pdf, 0, 0, $radius/30);
pdf_fill($pdf);
pdf_restore($pdf);
pdf_end_page($pdf);
/* 変化を見るために待つ */
sleep(1);
}
pdf_close($pdf);
$buf = pdf_get_buffer($pdf);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=foo.pdf");
print $buf;
pdf_delete($pdf);
?> |
|
注意:
PDFドキュメントを作成するための別のPHPモジュールとして
ClibPDFが利用可能です。
詳細については、ClibPDFの節を参
照下さい。ClibPDF はPDFlibとはや
や異なるAPIを使用していることに注意して下さい。
chu61 dot tw at gmail dot com
07-Mar-2005 03:57
How to get how many pages in a PDF? I read PDF spec. V1.6 and find this:
PDF set a "Page Tree Node" to define the ordering of pages in the document. The tree structure allows PDF applications, using little memory to quickly open a document containing thousands of pages.
If a PDF have 63 pages, the page tree node will like this...
2 0 obj
<< /Type /Pages
/Kidsn [ 4 0 R
10 0 R
]
/Count 63 <---- YES, got it
>>
endobj
[P.S] a PDF may not only a pages tree node, The right answer is in "root page tree node", if /Count XX with /Parent XXX node, it not "root page tree node"
SO, You must find the node with /Count XX and Without /Parent terms, and you'll get total pages of PDF
%PDF-1.0 ~ %PDF-1.5 all works
Alex form Taipei,Taiwan
mattb at bluewebstudios dot com
04-Feb-2005 09:44
I recently tested Donatas' code below for the extraction of text from PDF files. After running into a few problems where PDF files were not being read at all, I've modified it somewhat. It still isn't perfect, but should work great for searching. Thanks Donatas.
<?php
$test = pdf2string("<pathtoPDFfile>");
echo "$test";
function pdf2string($sourcefile)
{
$fp = fopen($sourcefile, 'rb');
$content = fread($fp, filesize($sourcefile));
fclose($fp);
$searchstart = 'stream';
$searchend = 'endstream';
$pdfdocument = "";
$pos = 0;
$pos2 = 0;
$startpos = 0;
while( $pos !== false && $pos2 !== false )
{
$pos = strpos($content, $searchstart, $startpos);
$pos2 = strpos($content, $searchend, $startpos + 1);
if( $pos !== false && $pos2 !== false )
{
$textsection = substr($content, $pos + strlen($searchstart) + 2, $pos2 - $pos - strlen($searchstart) - 1);
$data = @gzuncompress($textsection);
$data = ExtractText($data);
$startpos = $pos2 + strlen($searchend) - 1;
if( $data === false ) { return -1; }
$pdfdocument = $pdfdocument . $data;
}
}
return $pdfdocument;
}
function ExtractText($postScriptData)
{
while( (($textStart = strpos($postScriptData, '(', $textStart)) && ($textEnd = strpos($postScriptData, ')', $textStart + 1)) && substr($postScriptData, $textEnd - 1) != '\\') )
{
$plainText .= substr($postScriptData, $textStart + 1, $textEnd - $textStart - 1);
if( substr($postScriptData, $textEnd + 1, 1) == ']' ) {
$plainText .= ' ';
}
$textStart = $textStart < $textEnd ? $textEnd : $textStart + 1;
}
return stripslashes($plainText);
}
?>
ken at thesmallbox.com
30-Oct-2004 03:13
Please note that these functions have been removed from PHP 5. They are still available through the pdflib PECL module.
13-Aug-2004 06:58
for people who are using PDF_FINDFONT there is a catch..
--------------------------------------------------------
int PDF_findfont(PDF *p, const char *fontname, const char *encoding, int embed)
Deprecated, use PDF_load_font( ).
----
use PDF_load_font instead....
arjen at queek dot nl
15-Jul-2004 02:50
If you prefer a OO-approach to the PDF-functions, you can use this snippet of code (PHP5 only! and does add some overhead). It's just a "start-up", extend/improve as you wish...
You can pass all pdf_* functions to your object and stripping pdf_ of the function name. Plus, you don't have to pass the pdf-resource as the first argument.
For example:
<?php
pdf_show($pdf, $text); ?>
Can become:
<?php
$pdf->show($text); ?>
Code:
<?php
class PDF {
private $pdf;
public function __construct() {
$this->pdf = pdf_new();
}
public function __call($function, $arguments) {
array_unshift($arguments, $this->pdf);
return call_user_func_array('pdf_' . $function, $arguments);
}
}
?>
michi (Alt+Q) marel.at
01-Jul-2004 02:10
<?PHP
function calcToPt($intMillimeter) {
$intPoints = ($intMillimeter*72)/25.4;
$intPoints = round($intPoints);
return $intPoints;
}
pdf_begin_page( $pdf, calcToPt(210), calcToPt(297)); ?>
donatas at spurgius dot com
22-Jun-2004 07:56
I've been looking for a way to extract plain text from PDF documents (needed to search for text inside 'em). Not being able to find one I wrote the needed functions myself. here you go folks.
<?php
function pdf2string ($sourceFile)
{
$textArray = array ();
$objStart = 0;
$fp = fopen ($sourceFile, 'rb');
$content = fread ($fp, filesize ($sourceFile));
fclose ($fp);
$searchTagStart = chr(13).chr(10).'stream';
$searchTagStartLenght = strlen ($searchTagStart);
while ((($objStart = strpos ($content, $searchTagStart, $objStart)) && ($objEnd = strpos ($content, 'endstream', $objStart+1))))
{
$data = substr ($content, $objStart + $searchTagStartLenght + 2, $objEnd - ($objStart + $searchTagStartLenght) - 2);
$data = @gzuncompress ($data);
if ($data !== FALSE && strpos ($data, 'BT') !== FALSE && strpos ($data, 'ET') !== FALSE)
{
$textArray [] = ExtractText ($data);
}
$objStart = $objStart < $objEnd ? $objEnd : $objStart + 1;
}
return $textArray;
}
function ExtractText ($postScriptData)
{
while ((($textStart = strpos ($postScriptData, '(', $textStart)) && ($textEnd = strpos ($postScriptData, ')', $textStart + 1)) && substr ($postScriptData, $textEnd - 1) != '\\'))
{
$plainText .= substr ($postScriptData, $textStart + 1, $textEnd - $textStart - 1);
if (substr ($postScriptData, $textEnd + 1, 1) == ']') {
$plainText .= ' ';
}
$textStart = $textStart < $textEnd ? $textEnd : $textStart + 1;
}
return stripslashes ($plainText);
}
?>
uwe at steinmann dot cx
13-May-2004 01:25
Those looking for a free replacement of pdflib may consider
pslib at which produces PostScript but it can be easily turned into PDF by Acrobat Distiller or ghostscript. The API is very similar and even hypertext functions are supported. There
is also a php extension for pslib in PECL, called ps.
samcontact at myteks dot com
01-May-2004 11:28
Here is another great tutorial on basic PDF building w/ PHP:
=======================
Computer Repair & Web Design
=======================
james at lanpad dot org
19-Apr-2004 03:36
PDFLib has a free replacement, that also is much easier to work with too (no more working with co-ordinates from the bottom left hand corner!)!
Its also free for commercial use, and is very useable, unlike the PDFlib extensions.
kristian at ruazgo dot com
11-Mar-2004 10:32
If you want an opensource class for creating PDF-files, you can find it at :
matic at koncan dot net
12-Jan-2004 02:22
The solution for IE (refresh):
...
$buf = PDF_get_buffer($p);
$len = strlen($buf);
header("Cache-Control: no-store");
header("Cache-Control: no-cache");
header("Cache-Control: must-revalidate");
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=file.pdf");
print $buf;
PDF_delete($p);
SenorTZ senortz at nospam dot yahoo dot com
28-Jul-2003 01:23
About creating a PDF document based on the content of another document(let's say a text file):
I have tried to send to the PDF-creator page from a link from the sender page the file name of the file I want to read the content from and generate the PDF document containing this content. The idea is is that when I tried to reffer the pdf-creator page via the link your_root/create_pdf.php?filename=$your_file_name, the pdf-creator page does not behave well when before creating the pdf document I have a line like $filename = $_GET["filename"].
I solved this using on the sender page instead of the link a form with a button, so the form has as action "create_pdf.php", as method "post" and a hidden field containing the "filename" value. And it works like this if, on the pdf-creator page I have a line like $filename = $_POST["filename"].
I would like to understand why this way it works and the other way does not.
I hope this helps. Here are the pieces of code I used.
Sender page:
print("<form name='to_pdf' action='see_pdf_file.php' method='post'>");
print("<br/><input type='submit' value='PDF'><input type='hidden' name='filename' value='$filename'></form>");
PDF-creator page:
<?
$filename = $_POST["filename"];
$file_handle = fopen($filename, "r");
$file_content = file_get_contents($filename);
fclose($file_handle);
$file_content = wordwrap($file_content,72,"|");
$a_row = explode("|",$file_content);
$i = 0;
$pdf = pdf_new();
pdf_open_file($pdf, "");
pdf_begin_page($pdf, 595, 842);
pdf_set_font($pdf, "Times-Roman", 16, "host");
pdf_add_outline($pdf, "Page 1");
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, 'The content of the file:',50,700);
while ($a_row[$i] != "")
{
pdf_continue_text($pdf,$a_row[$i]);
$i++;
}
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=test.pdf");
header("Content-length: " . strlen($data));
echo $data;
?>
PDFLib and PHP 431 used.
Thanks.
bmironov at jonview dot com
24-Jun-2003 10:46
RedHat 9 + Apache 2.0 + PHP 4.3.2 + Oracle 9i + PDFlib 5.0.1 (binary distribution)
It seems to be a working bundle if you do some magic with ./configure:
RedHat 9:
kernel-2.4.20-18.9
Apache 2.0.46:
./configure --enable-so --enable-rewrite=shared --enable-status --enable-mpm=prefork
PHP 4.3.2:
./configure \
--program-prefix= \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--without-tsrm-pthreads \ # !!!!!!!!!!!!!!!!!!!!
--with-zlib \
--with-gd \
--enable-gd-native-ttf \
--with-ttf \
--without-mysql \
--with-apxs2filter=/usr/local/apache2/bin/apxs \
--with-oci8 \
--enable-sigchild \
--enable-inline-optimization
Oracle9i:
ln -s $ORACLE_HOME/rdbms/public/nzerror.h $ORACLE_HOME/rdbms/demo/nzerror.h
ln -s $ORACLE_HOME/rdbms/public/nzt.h $ORACLE_HOME/rdbms/demo/nzt.h
ln -s $ORACLE_HOME/rdbms/public/ociextp.h $ORACLE_HOME/rdbms/demo/ociextp.h
If you want to use bundled GD-library then:
1) install following packages: libjpeg, libjpeg-devel, libpng, libpng-devel, freetype, freetype-devel, libtiff, libtiff-devel, zlib, zlib-devel
2) ln -s /usr/lib/libjpeg.so.62 /usr/lib/libjpeg.so
ln -s /usr/lib/libpng.so.62 /usr/lib/libpng.so
It seems to be a working combination, because it is NOT give you:
1) error message in Apache's error_log:
Module compiled with module API=20020429, debug=0, thread-safety=0
PHP compiled with module API=20020429, debug=0, thread-safety=1
2) error message in Apache's error_log:
[notice] child pid 12345 exit signal Segmentation fault (11)
3) MS Internet Explorer can show PDF-output from your PHP-script via Acrobat plug-in and does not crush. No confusing messages about opening "Adobe Acrobat Control for ActiveX".
Hope it will save you some time.
Good luck,
Boris
matt at nospam dot org
29-Aug-2002 06:11
Adding to my prior note, IE 6 has a strange feature of using GET when refreshing a pdf document, even though the page was originally POSTed to. This may be the root cause of all the trouble listed above regarding posting and pdf.
So, I recommend:
1) using a two page form/action handler when doing pdf rendering instead of the standard $PHP_SELF form/self handler to resolve the problem discussed above
2) Using either GET, or a self posting form that sets cookies and then redirects to the pdf creation page instead of POST, so that the parms get to the page. HTH
gilbertng at hongkong dot com
11-Jun-2002 10:23
Hope it can help someone:
$pdf = pdf_new();
//pdf_open_file($pdf,"");
if (!pdf_open_file($pdf, "")) {
print error;
exit;
}
PDF_set_parameter($pdf, "resourcefile", "/usr/local/pdflib/fonts/pdflib.upr");
PDF_set_parameter($pdf,"prefix","/usr/local/pdflib/fonts");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
//pdf_set_font($pdf, "Times-Roman", 30, "host");
// set chinese characters,
$font = pdf_findfont($pdf, "MHei-Medium", "B5pc-H",0);
if ($font) {
pdf_setfont($pdf, $font, 30);
}
pdf_set_value($pdf, "textrendering",0);
pdf_show_xy($pdf, "���� 100 Roman outlined", 50, 750);
pdf_set_font($pdf, "Times-Roman", 30, "host");
pdf_show_xy($pdf, "���� Times Roman outlined", 50, 600);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
$buf = pdf_get_buffer($pdf);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=foo.pdf");
print $buf;
pdf_delete($pdf);
chernyshevsky at hotmail dot com
06-May-2002 10:22
If you're wondering how to highlight words inside a PDF file, take a look at this script I've written (doesn't need PDFLib)
It's a whole lot harder than you think. (Rarely has no much code been written that does so little, that's what I say :-) Worth looking at if you want to do searches inside a PDF.
pbierans at lynet dot de
27-Mar-2002 05:56
Load extension, open a PDF, add a font, modify PDF in memory and send
it to browser:
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$ext_name="libpdf_php.so";
if (!extension_loaded($ext_name) && !@dl($ext_name))
{
?>
<table width="100%" border="0"><tr><td align="center">
<table style="border: solid #f0f0f0 2px;"><tr>
<td valign="middle" style="padding: 20px; margin: 0px;">
<p style="font-family: arial; font-size: 12px; ">
<b>Sorry,</b><br>
<br>
A PDF can not be generated right now.<br>
The administrator has been informed and will fix this as
soon as possible.<br>
Please try again later.
</p>
</td></tr></table>
</td></tr></table>
<?php
mail('[email protected]','Error: PDFLib not found',
'Called by script:\n '.$SCRIPT_FILENAME.'?'.$QUERY_STRING,
"From: [email protected]\n");
exit;
} srand(microtime()*10000);
$usnr= gmdate("Ymd-His-").rand(1000,9999).'-';
$pdf_file=$usnr.'result.pdf';
$src_file='source.pdf';
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_set_parameter($pdf, 'serial', 'if-you-have-one');
pdf_set_parameter($pdf, 'FontAFM', 'TradeGothic=Tg______.afm');
pdf_set_parameter($pdf, 'FontOutline', 'TradeGothic=Tg______.pfb');
pdf_set_parameter($pdf, 'FontPFM', 'TradeGothic=Tg______.pfm');
$src_doc =pdf_open_pdi($pdf,$src_file,'', 0);
$src_page =pdf_open_pdi_page($pdf,$src_doc,1,'');
$src_width =pdf_get_pdi_value($pdf,'width' ,$src_doc,$src_page,0);
$src_height=pdf_get_pdi_value($pdf,'height',$src_doc,$src_page,0);
pdf_begin_page($pdf, $src_width, $src_height);
{
pdf_place_pdi_page($pdf,$src_page,0,0,1,1);
pdf_close_pdi_page($pdf,$src_page);
pdf_set_font($pdf, 'TradeGothic', 8, 'host');
pdf_show_xy($pdf, 'Now: '.gmdate("Y-m-d H:i:s"),50,50);
}
pdf_end_page($pdf);
pdf_close($pdf);
$pdfdata = pdf_get_buffer($pdf); $pdfsize = strlen($pdfdata); header('Content-type: application/pdf');
header('Content-disposition: attachment; filename="'.$pdf_file.'"');
header('Content-length: '.$pdfsize);
echo $pdfdata;
exit; ?>
bob at nijman dot de
02-Aug-2001 11:20
Try these tutorials:
************************************
************************************
a dot marchand dot nospam at home dot com
01-May-2001 07:42
To continue on the internet explorer (Iexplorer, IE) requirements, instead of content-length, a simple:
header("Accept-Ranges: bytes");
is enough for the getpdf.php file working right. Even Netscape will without error with this modification.
Aurelien
| |