Wrox Home  
Search P2P Archive for: Go

  Return to Index  

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


Message #1 by qto@d... on Mon, 20 Aug 2001 16:38:28
Does anyone know of any other scripts/components to do this BESIDES the 

products of Active PDF?



I would like to have a button on my ASP pages to print/display that page 

as PDF.



Thanks

Message #2 by Eena-Ian Dulay <eenaian@y...> on Mon, 20 Aug 2001 19:56:36 -0700 (PDT)
Hi,



Why not try this article from "Creating a PDF with ASP

By Ty Button" 

http://www.15seconds.com/issue/990902.htm. It help me

with my ASP and ColdFusion projects.



Best Regards,



Dennis





--- qto@d... wrote:

> Does anyone know of any other scripts/components to

> do this BESIDES the 

> products of Active PDF?

> 

> I would like to have a button on my ASP pages to

> print/display that page 

> as PDF.

> 

> Thanks

> 

>
Message #3 by "Marco Duarte" <duarte_calderon@h...> on Tue, 21 Aug 2001 04:10:48
Microsoft Word might be an option.  with Visual Basic you can make an 

ActiveX where you make an instance of Word, open the document you want to 

make a PDF, set the Active Printer as Acrobat writer, call the printout 

method of word giving a filename as a parameter.



For this you would need Acrobat Writer installed in the server machine.  

visit http://www.adobe.com/support/database.html, they have an example there 

that helped me.



try Word to PDF or something...



Marco Duarte



Message #4 by Robert Illing <Robert.Illing@f...> on Tue, 21 Aug 2001 08:55:58 +0100
In the past, I've used HTMLDOC.  Basically, you write the HTML to a file,

use the .exe to convert to PDF, and then stream the results to the browser.

Here's the URL:



http://www.easysw.com/htmldoc/



Hope this helps,



Rob



> -----Original Message-----

> Subject: Convert HTML/ASP to PDF on the FLY?

> From: qto@d...

> Date: Mon, 20 Aug 2001 16:38:28

> X-Message-Number: 6

>

> Does anyone know of any other scripts/components to do this BESIDES the 

> products of Active PDF?

>

> I would like to have a button on my ASP pages to print/display that page 

> as PDF.

>

> Thanks

Message #5 by "Quy To" <qto@d...> on Tue, 21 Aug 2001 10:14:43 -0500
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

----- Original Message -----

From: "Robert Illing" <Robert.Illing@f...>

To: "ASP components" <asp_components@p...>

Sent: Tuesday, August 21, 2001 2:55 AM

Subject: [asp_components] RE: Convert HTML/ASP to PDF on the FLY?





> In the past, I've used HTMLDOC.  Basically, you write the HTML to a file,

> use the .exe to convert to PDF, and then stream the results to the

browser.

> Here's the URL:

>

> http://www.easysw.com/htmldoc/

>

> Hope this helps,

>

> Rob

>

> > -----Original Message-----

> > Subject: Convert HTML/ASP to PDF on the FLY?

> > From: qto@d...

> > Date: Mon, 20 Aug 2001 16:38:28

> > X-Message-Number: 6

> >

> > Does anyone know of any other scripts/components to do this BESIDES the

> > products of Active PDF?

> >

> > I would like to have a button on my ASP pages to print/display that page

> > as PDF.

> >

> > Thanks

Message #6 by Robert Illing <Robert.Illing@f...> on Wed, 22 Aug 2001 08:54:10 +0100
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