Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support

All forums · Statistics · Search ·

Two Pilots forum / For software developers / Need of ASP Assistance
Author Message
# Posted: 20 Dec 2005 12:01


I am evaluating html2pdf products. I have installed pdf pilot creator and the html2pdf add on. I can run the windows app(vbs) to test the html2pdf functionality and it converts a html to a pdf doc. I want to recreate the same functionality in an asp or in
I have had no sucess in doing so. Please can someone post an asp page or page which gets a html page and then returns the user a pdf doc.

pl tell me the solution urgently
Thanks in advance

# Posted: 20 Dec 2005 15:02


Here is asp example for PDF Creator Pilot
and here is example for HTML2PDF Add-on
You can use examples to create asp script.

Something like this:

Private Sub Page_Load( ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click

Dim PDF ' PDF object

Dim Size As Long

Dim PDFImage As System.Array

' create pdf library object

PDF = CreateObject("PDFCreatorPilot2.piPDFDocument")

' initialize PDF Engine

PDF.StartEngine("demo@demo", "demo")

' set GenerateInMemoryFile generation flag to TRUE so keep PDF ' only in the memory

PDF.GenerateInMemoryFile = True

' start document generation


Set HTML = CreateObject("HTML2PDFAddon.HTML2PDF")

' initialize HTML engine


' connect to PDF Creator Pilot instance


' load HTML file into HTML renderer

HTML.LoadFromString("<HTML><BODY><H1>Hello, HTML2PDF!</H1></BODY></HTML>", "")

' convert whole HTML document into PDF


' disconnect from PDF Creator Pilot instance


HTML = Nothing

' finalize document generation

PDF.EndDoc() ' clear the output stream

' get size of generated in-memory pdf file

Size = PDF.MemoryFileSize

' create new buffer with size equal to generated pdf file

Dim PDFBuffer( CInt (Size)) As Byte

' get in-memory pdf file as byte stream

PDFImage = PDF.BinaryImage

' copy byte stream into buffer

Array.Copy(PDFImage, PDFBuffer, Size)

' clear http output


' set the content type to PDF

Response.ContentType = "application/pdf"

' add content type header

Response.AddHeader("Content-Type", "application/pdf")

' set the content disposition

Response.AddHeader("Content-Disposition", "inline;filename=form.pdf")

' write the buffer with pdf file to the output



' disconnect from library

PDF = Nothing

End Sub

Thank you very much !

Best regards,
Two Pilots



Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.014


Page top