Re: XSL:FO + PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan,

I'm glad this may work for you. As far as the speed: it's of course difficult to judge, and I certainly didn't test it under any real load, but I had no problems creating and serving a several page document with graphics in it. We were testing the concept of something like this for a system with a non-public system, so weren't overlly concerned about testing the efficiency of this, especially since this wasn't to be our final approach. I'd be interested if you find out more information on the subject.

On using passthru: I do not think FOP has the option to passthru the PDF output from the command line call. It was necessary to save the generated PDF and then serve it. (I haven't double checked, but I think I saved the file because I had to.) Of course FOP is open source so you have the opportunity to make it work with you.

kgt


Dan Rossi wrote:


On 05/05/2005, at 1:47 AM, Kristen G. Thorson wrote:




Dan,

I have done this before, but it was only a proof-of concept excercise for me, so my procedure may not work for you. My test was against an Amazon web service and generating a PDF from the XML returned to me.

This method used Apache's FOP. Before executing the following code, I saved the XML returned from Amazon as a temp file ($xmlfile).

$PDFfile = "$xmlfile.pdf";
$callstring = "$FOPpath/fop.sh -xsl $xslforoot/$xslfofile -xml $xmlfile -pdf $PDFfile";
$answer = shell_exec( $callstring );
header( "Content-type: $ctype" );
$pieces = explode( "/", $xmlfile );
header( "Content-Disposition: attachment; filename=".$pieces[ count( $pieces )-1 ] );
readfile( "$xmlfile.pdf" );



I hope this is helpful to you, kgt



Hi yes this is exactly what i may have to do. I have tried all the usual outlets in terms of subclasses of FPDF , all are limited and crappy, it just cant do tables properly. The closest I got was with PDML however it was still tedious to build a table with ! Now I think processing for such a command line would take forever this is what I need to do, a print button displays on the header of a form entry. What i need to do is collect the data from that database entry and display it as a view with the data rather than the form and make it printable in a pdf. This ideally means generate xml from the db entry, save it as a file, execute commandline with temp xml file, readfile the pdf. I dont think it should take too long to output to the browser right ? I think a step i'd like to skip is the readfile, and work out how to send to standard output and use passthru ?


In the past I have used an app called HTMLDoc, its the bomb for making pdf manuals with chapters and table of contents. It also requires saving a temp html file and then sends the pdf as standard output. However HTMLDoc is not free anymore, I only have one licence for that to make docs only.


.


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux