craygo Posted November 2, 2006 Share Posted November 2, 2006 I have a page called salesack.php. It has some queries in it and essentially outputs a page. What I want to do is store the output from the script to a variable to be used to create a pdf file. So what I want to do it take the actual page that is being viewed and make it into a pdf file.hope I explained it enough.Thanksray Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/ Share on other sites More sharing options...
craygo Posted November 2, 2006 Author Share Posted November 2, 2006 Changed the topic. :) Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/#findComment-118659 Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 You can use output buffering and save the buffer. eg;[code]<?php ob_start(); echo "here is some php outputed text"; $output = ob_get_contents(); ob_end_clean(); echo $output; // this will echo 'here is some php outputed text'?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/#findComment-118687 Share on other sites More sharing options...
kenrbnsn Posted November 2, 2006 Share Posted November 2, 2006 I don't believe that will give craygo the result wanted. I think what he wants is to take a screen shot of the displayed page and convert that to a PDF file, all under program control.Ken Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/#findComment-118695 Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 [quote]What I want to do is store the output from the script to a variable[/quote]Yeah... I may be wrong, but thats the impression I got. Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/#findComment-118699 Share on other sites More sharing options...
kenrbnsn Posted November 2, 2006 Share Posted November 2, 2006 Yes, but the rest of the post[quote]to be used to create a pdf file. So what I want to do it [b][i][color=red]take the actual page that is being viewed and make it into a pdf file[/color][/i][/b].[/quote] (emphasis mine)Seems to say that he wants to capture what's on the screen.Ken Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/#findComment-118759 Share on other sites More sharing options...
craygo Posted November 3, 2006 Author Share Posted November 3, 2006 yes That is what I want to do. I got 2 classes fpdf and html2fpdf. They both seem to work just fine, but have there limitations. It won't work on the type of page I have. If I manually put in some html code then convert it, it seems to work fine. I have a pretty complicated page with css, backround colors, classes and tables within tables. So it seems that these programs, however pretty good for basic pdf creation, will not work for what I need. I have used output buffering to get the page and it does work. If I echo out the buffer the pages shows perfectly. If anyone has any other ideas, let me know.thanksRayPS. Here is the html code that gets generated from the buffer[code]<html><head><link href="http://192.168.20.127/ult/ult.css" rel="stylesheet" type="text/css" /></head><body><table width=700 align=center> <tr> <td align=center><h1>Universal Label Technologies, Inc.</h1></td> </tr> <tr> <td align=center><u>Sales Order Acknowledgement</u></td> </tr></table><table width=700 align=center> <tr> <td width=350 align=center> <table width=100%> <tr> <td colspan=2 bgcolor=c0c0c0><strong>Invoice Information</strong></td> </tr> <tr> <td colspan=2 class=border> <table width=100%> <tr> <td width=75>Customer:</td> <td width=280>A.H. ELECTRONICS<td> </tr> </table> </td> </tr> <tr> <td colspan=2 class=border> <table width=100%> <tr> <td width=75>Address:</td> <td width=280>374 Islip Avenue<td> </tr> <tr> <td width=75> </td> <td width=280>Islip, NY 11751-<td> </tr> <tr> <td width=75> </td> <td width=280> <td> </tr> </table> </td> </tr> <tr> <td colspan=2 class=border> <table width=100%> <tr> <td width=75>Contact:</td> <td width=280>Ray G<td> </tr> </table> </td> </tr> </table> </td> <td width=350 align=center> <table width=100%> <tr> <td colspan=2 bgcolor=c0c0c0><strong>Shipping Information</strong></td> </tr> <tr> <td colspan=2 class=border> <table width=100%> <tr> <td width=70>Customer:</td> <td width=280>A.H. ELECTRONICS<td> </tr> </table> </td> </tr> <tr> <td colspan=2 class=border> <table width=100%> <tr> <td width=70>Address:</td> <td width=280>374 Islip Avenue<td> </tr> <tr> <td width=70> </td> <td width=280>Islip, NY 11751-<td> </tr> <tr> <td width=70> </td> <td width=280> <td> </tr> </table> </td> </tr> <tr> <td colspan=2 class=border> <table width=100%> <tr> <td width=70>Contact:</td> <td width=280>Ray G<td> </tr> </table> </td> </tr> </table> </td> </tr></table><table width=700 align=center> <tr> <td class=border bgcolor=#DCDADA width=140 align=center>Purchase Order</td> <td class=border bgcolor=#DCDADA width=140 align=center>ULT Job Number</td> <td class=border bgcolor=#DCDADA width=140 align=center>Ship Method</td> <td class=border bgcolor=#DCDADA width=140 align=center>Terms</td> <td class=border bgcolor=#DCDADA width=140 align=center>Sales Rep</td> </tr> <td class=border align=center>AH-S00443</td> <td class=border align=center>103936</td> <td class=border align=center>UPS Gound</td> <td class=border align=center>NET 30</td> <td class=border align=center>JDM</td> </tr> <tr> <td class=border bgcolor=#DCDADA align=center>Order Date</td> <td class=border bgcolor=#DCDADA align=center>Expected Ship</td> <td class=border bgcolor=#DCDADA align=center>Ship Date</td> <td colspan=2 class=border bgcolor=#DCDADA align=center>$ Label Total $</td> </tr> <td class=border align=center>12/25/2004</td> <td class=border align=center>12/25/2004</td> <td class=border align=center>12/25/2004</td> <td colspan=2 class=border align=center>$1,700.00</td> </tr></table><hr /><table width=700 align=center cellpadding=0 cellspacing=0> <tr bgcolor=#DCDADA> <td class=stitles width=60 align=center class=stitles>Quantity<br>Ordered</td> <td class=stitles width=60 align=center class=stitles>Quantity<br>Shipped</td> <td class=stitles width=60 align=center class=stitles>Back<br>Ordered</td> <td class=stitles width=120 align=center class=stitles>Part Number</td> <td class=stitles width=280 align=center class=stitles>Description</td> <td class=stitles width=60 align=center class=stitles>Unit Price</td> <td class=stitlesr width=60 align=center class=stitles>Extended<br>Price</td> </tr></table><table width=700 align=center cellspacing=0 cellpadding=0 height=485> <tr> <td width=100% align=center valign=top> <table width=100%> <tr> <td class=sdets width=60 align=center>100000</td> <td class=sdets width=60 align=center>100000</td> <td class=sdets width=60 align=center>0</td> <td class=sdets width=120 align=center>ULVAH-1001</td> <td class=sdets width=280 align=center>CAL</td> <td class=sdets width=60 align=right>$0.0170</td> <td class=sdets width=60 align=right>$1,700.00</td> </tr> </table> </td> </tr></table><table width=700 align=center> <tr> <td width=515> </td> <td width=110><strong>Sub Total:</strong></td> <td width=75 align=right>$1,700.00 </tr> <tr> <td> </td> <td><strong>Freight Charge:</strong></td> <td align=right>$100.00 </tr> <tr> <td> </td> <td><strong>Tax:</strong></td> <td align=right>$119.00 </tr> <tr> <td> </td> <td><strong>Grand Total:</strong></td> <td align=right>$1,919.00 </tr></table><table width=700 align=center> <tr> <td class=topline width=350 align=left><i>Friday, November 03, 2006</i></td> <td class=topline width=350 align=right><i>Page 1</i></td> </tr></table></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/#findComment-119142 Share on other sites More sharing options...
craygo Posted November 3, 2006 Author Share Posted November 3, 2006 Guess i am out of luck on this one. Quote Link to comment https://forums.phpfreaks.com/topic/25967-store-php-output/#findComment-119198 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.