Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Re: Convert HTML/ASP to PDF on the FLY?


Message #1 by "Mario Marcio" <mmarcio_sp@h...> on Fri, 18 Oct 2002 20:53:52
Hello,

Please, i´m searching all day for the HTMLDOC.EXE version for windows and 
it seems that easysw has changed the way the distribuite it, now we can 
only find an GUI version.... Please it is very important for my project.

thanks in advance.
Mario Marcio
Brazil

> Here's the code we used with the HTMLDOC.EXE program.
> 
> <% Case "PDF"
>     Dim Sys, File, Stream, HTML, PDF
>     HTML = Application("Path")&"temp\"&Session("UserID")&".htm"
>     PDF = Application("Path")&"temp\"&Session("UserID")&".pdf"
>     Set Sys = Server.CreateObject("Scripting.FileSystemObject")
>     Set File = Sys.CreateTextFile(HTML)
>     File.Write Output
>     File.Close
>     objConn.DefaultDatabase = "master"
>     objConn.Execute "xp_cmdshell 'D:\SOFTWARE\HTMLDOC\HTMLDOC.EXE -t pdf
> --top 5 --bottom 5 --left 5mm --right 5mm --webpage --pagemode document
> "&HTML&" -f "&PDF&"', no_output",,129
>     Set File = Nothing
>     Set Sys = Nothing
>     Set Stream = Server.CreateObject("ADODB.Stream")
>     Stream.Open
>     Stream.LoadFromFile PDF
>     Response.ContentType = "application/pdf"
>     Response.BinaryWrite Stream.ReadText
>     Set Stream = Nothing %>
> 
> It's messy and uses the file system, but it worked great for us.  Very
> efficient.  You might want to check out some of the other suggestions 
made
> too.
> 
> Cheers,
> 
> Rob
> 
> >-----Original Message-----
> >Subject: RE: Convert HTML/ASP to PDF on the FLY?
> >From: "Quy To" <qto@d...>
> >Date: Tue, 21 Aug 2001 10:14:43 -0500
> >X-Message-Number: 5
> >
> >Thanks Rob.
> >This HTMLDOC program does not work for ASP pages. For HTML, it works 
okay.
> >I'm trying to display my asp pages, something like report.asp?id=12345 
to
> >the browser as PDF file so that the users can print or download it.
> >
> >qto

  Return to Index