Reply
how do I get the html string?
Old 04-27-2008, 02:36 AM how do I get the html string?
Webmaster Talker

Posts: 554
I have downloaded the Prince.php class which converts an html/xhtml/xml file into a PDF. It works perfectly as I have done it from the command line without a problem.

The method that I used to do it in the command line was:
Code:
# php index.php > index.xml
# prince index.xml
this creates a file called index.pdf and it works perfectly.

Now... I tried running:

Code:
system('php index.php > index.xml');
This created the xml file but did NOT put the contents of the file into it.

So... I am calling index.php using POST to get some variables into it from a form. I then dynamically determine the output of the page using the value of those variables. Now I need to somehow get the XHTML stream from what is displayed in the browser and send it to the prince method that I'm calling to convert the xml stream to PDF.

I hope this made sense. Any ideas?
zincoxide is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-28-2008, 10:00 PM Re: how do I get the html string?
addonchat's Avatar
Skilled Talker

Posts: 97
Name: Chris Duerr
First question is, can you pipe input through to prince? E.g.,

# php index.php | prince > index.pdf
or to display:
# php index.php | prince

Not sure why what you did doesn't work, I usually do my CLI stuff in Perl.

From http://us.php.net/system :
"If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends."

Just curious if maybe you attempted to read the index.xml file before the program finished? Have you tried just using backticks (``) or shell_exec?
__________________
Chris Duerr
AddonChat Java Chat Software
http://www.addonchat.com/ - Affiliate Program
addonchat is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 10:46 AM Re: how do I get the html string?
Webmaster Talker

Posts: 554
No I didn't try it... But I got it working thank you.

I ended up using ob_start() and just saving the output to a variable and then I didn't have to use file handling at all. I just called the price function to convert a string to pdf.

Thanks for the help though!
zincoxide is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how do I get the html string?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12247 seconds with 12 queries