NYCPHP Meetup

NYPHP.org

[nycphp-talk] HTML -> PDF

Mark Withington mwithington at PLMresearch.com
Tue May 31 13:02:05 EDT 2005


Really appreciate it Russ.  Will give that a try.

Mark

--------------------------
Mark L. Withington
PLMresearch
v: 508-746-2383
m: 508-801-0181
Calendar: http://www.plmdev.com/plmr/plmresearch.com/calendar.php




> -----Original Message-----
> From: talk-bounces at lists.nyphp.org 
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Russ Demarest
> Sent: Tuesday, May 31, 2005 12:54 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] HTML -> PDF
> 
> 
> If you create the PDF on the server then pass it to the browser it  
> may work better. I am not sure of heavy load on a thing like 
> this but  
> it has worked for me.
> 
>      Have HTMLDOC output the file to the server. Then open that and  
> feed it back to the browser.
> 
>                  $out_pdf=fopen($file_out,'rb');
>                  $fisz = filesize($file_out);
> 
>                  # Write the content type to the client...
>                  header("Cache-Control: ");// leave blank to 
> avoid IE  
> errors
>                  header("Pragma: ");// leave blank to avoid IE errors
>                  header("Content-type: application/octet-stream");
>                  header("Content-Disposition: attachment; filename= 
> \"my_pdf.pdf\"");
>                  header("Content-length: ".(string)($fisz));
>                  flush();
> 
>                  fpassthru($out_pdf);
>                  fclose($out_pdf);
> 
>                  exit;
> 
> 
>      Remember to create the file and set the permissions so the  
> webserver can write to it. Also you may want to delete the HTML and  
> PDF after generation depending on security issues.
> 
>      Good Luck
> 
> 
> On May 31, 2005, at 12:46 PM, Mark Withington wrote:
> 
> > Hah!  We're getting closer.  Saved the file to disk (locally) first
> > and then
> > opened it without a problem.  Any thoughts?
> >
> > Really appreciate all the help.  Had I asked sooner, I might have
> > gotten
> > more sleep last night.
> >
> >
> > --------------------------
> > Mark L. Withington
> > PLMresearch
> > "eBusiness for the Midsize Enterprise"
> > PO Box 1354
> > Plymouth, MA  02362
> > o: 800-310-3992 ext. 704
> > f: 508-746-4973
> > v: 508-746-2383
> > m: 508-801-0181
> > http://www.PLMresearch.com
> > Netscape/AOL/MSN IM: PLMresearch
> > mwithington at plmresearch.com
> > Public Key:
> > http://www.plmdev.com/plmr/plmresearch.com/keys/MLW_public_key.asc
> > Calendar: http://www.plmdev.com/plmr/plmresearch.com/calendar.php
> >
> >
> >
> > -----Original Message-----
> > From: talk-bounces at lists.nyphp.org
> > [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Russ Demarest
> > Sent: Tuesday, May 31, 2005 12:35 PM
> > To: NYPHP Talk
> > Subject: Re: [nycphp-talk] HTML -> PDF
> >
> >
> > You should be able to right click on a link to the PDF and select
> > "Save Link As".
> >
> > Good Luck
> >
> > On May 31, 2005, at 12:29 PM, Mark Withington wrote:
> >
> >
> >> Don't save on the server.  Will try saving the file and then
> >> opening it.  As
> >> I recall, I need to adjust Acrobat for this.
> >>
> >>
> >> --------------------------
> >> Mark L. Withington
> >> PLMresearch
> >> "eBusiness for the Midsize Enterprise"
> >> PO Box 1354
> >> Plymouth, MA  02362
> >> o: 800-310-3992 ext. 704
> >> f: 508-746-4973
> >> v: 508-746-2383
> >> m: 508-801-0181
> >> http://www.PLMresearch.com
> >> Netscape/AOL/MSN IM: PLMresearch
> >> mwithington at plmresearch.com
> >> Public Key:
> >> http://www.plmdev.com/plmr/plmresearch.com/keys/MLW_public_key.asc
> >> Calendar: http://www.plmdev.com/plmr/plmresearch.com/calendar.php
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: talk-bounces at lists.nyphp.org
> >> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Russ Demarest
> >> Sent: Tuesday, May 31, 2005 12:27 PM
> >> To: NYPHP Talk
> >> Subject: Re: [nycphp-talk] HTML -> PDF
> >>
> >>
> >> Are you saving saving the PDF file on the server then sending it to
> >> the browser/acrobat? Acrobat may think something is wrong if it
> >> stalls while HTMLDOC is generating the doc. Is it a large document?
> >> If you save what is generated my HTMLDOC on your local machine then
> >> open it with Acrobat does it work?
> >>
> >>
> >>
> >> On May 31, 2005, at 11:56 AM, Mark Withington wrote:
> >>
> >>
> >>
> >>> Thanks for the great input.  I'm really stumped.  The pages are
> >>> dynamically
> >>> generated.  If I simply save that as HTML and then run it through
> >>> HTMLDOC;
> >>> no problem.  When I run it, generated on the fly, the page throws
> >>> an error.
> >>> Even stranger, the page prints correctly with other data (HTML
> >>> generated
> >>> from a mysql db) and even display correctly via HTMLDOC through
> >>> another
> >>> (similar) application using the same database.
> >>>
> >>> Does anyone know if there is an error log file in Acrobat?  The  
> >>> debug
> >>> message is pretty weak, ""the file is damaged and could not be
> >>> repaired"
> >>>
> >>>
> >>> --------------------------
> >>> Mark L. Withington
> >>> PLMresearch
> >>> "eBusiness for the Midsize Enterprise"
> >>> PO Box 1354
> >>> Plymouth, MA  02362
> >>> o: 800-310-3992 ext. 704
> >>> f: 508-746-4973
> >>> v: 508-746-2383
> >>> m: 508-801-0181
> >>> http://www.PLMresearch.com
> >>> Netscape/AOL/MSN IM: PLMresearch
> >>> mwithington at plmresearch.com
> >>> Public Key:
> >>> http://www.plmdev.com/plmr/plmresearch.com/keys/MLW_public_key.asc
> >>> Calendar: http://www.plmdev.com/plmr/plmresearch.com/calendar.php
> >>>
> >>>
> >>>
> >>> -----Original Message-----
> >>> From: talk-bounces at lists.nyphp.org
> >>> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Russ Demarest
> >>> Sent: Tuesday, May 31, 2005 9:13 AM
> >>> To: NYPHP Talk
> >>> Subject: Re: [nycphp-talk] HTML -> PDF
> >>>
> >>>
> >>> HTMLDOC is a great app but it could be many things. Did your HTML
> >>> change? Is the HTML for the PDF generated dynamically? If so,  
> >>> perhaps
> >>> someone entered a strange character or something else that is
> >>> creating the bad PDF. Have you checked the HTMLDOC forums?
> >>>
> >>> http://htmldoc.org/
> >>>
> >>> Does it generate some pages correctly and not others? I 
> usually have
> >>> to work it down until I can find a hanging white space or 
> stray tag
> >>> that is problematic. Does the PDF open in any other reader? The
> >>> encryption might be causing an issue, are you using that? Best  
> >>> bet is
> >>> to try to recreate the error in a controlled environment, 
> ie. simple
> >>> HTML.
> >>>
> >>> Good Luck
> >>>
> >>> On May 31, 2005, at 8:59 AM, Mark Withington wrote:
> >>>
> >>>
> >>>
> >>>
> >>>> I've been using htmldoc-1.8.23 for quite sometime to convert HTML
> >>>> to PDF's
> >>>> on the fly.  Recently I've been getting a lot of 
> intermittent "the
> >>>> file is
> >>>> damaged and could not be repaired" messages from Acrobat.  Has
> >>>> anyone had
> >>>> experience tracking down errors like this?  Any suggestion for
> >>>> other HTML -
> >>>> PDF (preferably php based) scripts that might work - I need to
> >>>> convert
> >>>> images and text.
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Mark
> >>>>
> >>>>
> >>>> --------------------------
> >>>> Mark L. Withington
> >>>> PLMresearch
> >>>> "eBusiness for the Midsize Enterprise"
> >>>> PO Box 1354
> >>>> Plymouth, MA  02362
> >>>> o: 800-310-3992 ext. 704
> >>>> f: 508-746-4973
> >>>> v: 508-746-2383
> >>>> m: 508-801-0181
> >>>> http://www.PLMresearch.com
> >>>> Netscape/AOL/MSN IM: PLMresearch
> >>>> mwithington at plmresearch.com
> >>>> Public Key:
> >>>> 
> http://www.plmdev.com/plmr/plmresearch.com/keys/MLW_public_key.asc
> >>>> Calendar: http://www.plmdev.com/plmr/plmresearch.com/calendar.php
> >>>>
> >>>> _______________________________________________
> >>>> New York PHP Talk Mailing List
> >>>> AMP Technology
> >>>> Supporting Apache, MySQL and PHP
> >>>> http://lists.nyphp.org/mailman/listinfo/talk
> >>>> http://www.nyphp.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>> _______________________________________________
> >>> New York PHP Talk Mailing List
> >>> AMP Technology
> >>> Supporting Apache, MySQL and PHP
> >>> http://lists.nyphp.org/mailman/listinfo/talk
> >>> http://www.nyphp.org
> >>> _______________________________________________
> >>> New York PHP Talk Mailing List
> >>> AMP Technology
> >>> Supporting Apache, MySQL and PHP
> >>> http://lists.nyphp.org/mailman/listinfo/talk
> >>> http://www.nyphp.org
> >>>
> >>>
> >>>
> >>
> >> _______________________________________________
> >> New York PHP Talk Mailing List
> >> AMP Technology
> >> Supporting Apache, MySQL and PHP
> >> http://lists.nyphp.org/mailman/listinfo/talk
> >> http://www.nyphp.org
> >> _______________________________________________
> >> New York PHP Talk Mailing List
> >> AMP Technology
> >> Supporting Apache, MySQL and PHP
> >> http://lists.nyphp.org/mailman/listinfo/talk
> >> http://www.nyphp.org
> >>
> >>
> >
> > _______________________________________________
> > New York PHP Talk Mailing List
> > AMP Technology
> > Supporting Apache, MySQL and PHP
> > http://lists.nyphp.org/mailman/listinfo/talk
> > http://www.nyphp.org
> > _______________________________________________
> > New York PHP Talk Mailing List
> > AMP Technology
> > Supporting Apache, MySQL and PHP
> > http://lists.nyphp.org/mailman/listinfo/talk
> > http://www.nyphp.org
> >
> 
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 



More information about the talk mailing list