Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a PDF file from ASP?

Status
Not open for further replies.

tondarb

Programmer
Oct 8, 2003
37
US
Hi All,

I am trying to create a PDF file from ASP. I want to know whether there is any free tool , or is there any code to create a PDF file from ASP. If so please suggest me..
It is very very urgent.

thanks in advance
 
1. I would suggest to reseach about and downloading their toolkit


2. I ran into this sample syntax that creates a pdf from and SQL statement and a few asp lines:


<%

'YOUR SQL STATEMENT HERE
request(&quot;idnref&quot;)
Dim oRSNew
Set oRSNew = Server.CreateObject(&quot;ADODB.Recordset&quot;)
oRSNew.open sql1, &quot;dsn=SQL_DATABASE;uid=XXX;pwd=XXX&quot;

response.buffer = True
response.expires = 0

'create and populate the PDF File =======================================================================
Set APToolkit = Server.CreateObject(&quot;APToolkit.Object&quot;)
APToolkit.OutputPageWidth=612
APToolkit.OutputPageHeight=792
r = APToolkit.OpenOutputFile(&quot;MEMORY&quot;)

'Set field values to equal your variables
vara = &quot;Instructions to: & ORSNew(&quot;Client&quot;)
varb1 = &quot;More instructions&quot;
varb2 = &quot;More instructions&quot;
varb3 = &quot;More instructions&quot;
varb4 = &quot;More instructions&quot;
varb5 = &quot;More instructions&quot;
varb6 = &quot;More instructions&quot;
varb7 = &quot;More instructions&quot;

varc = &quot;More instructions&quot;
varc1 = &quot;More instructions&quot;
varc2 = &quot;More instructions&quot;
varc3 = &quot;More instructions&quot;
varc4 = &quot;More instructions&quot;
varc5 = &quot;More instructions&quot;
varc6 = &quot;More instructions&quot;

vard = &quot;If you need assistance, please e-mail support@company.com or call (xxx) xxx-xxxx.&quot;

APToolkit.SetFont &quot;Times-Roman&quot;,18
APToolkit.LineWidth(1)
'=========================================Header Section======================
'APToolkit.PrintText 36,548,reqTitleLine

APToolkit.PrintText 36,720,vara
APToolkit.SetFont &quot;Times-Roman&quot;,12

APToolkit.PrintText 36,660,varb1
APToolkit.PrintText 36,640,varb2
APToolkit.PrintText 36,620,varb3
APToolkit.PrintText 36,600,varb4
APToolkit.PrintText 36,580,varb5
APToolkit.PrintText 36,560,varb6
APToolkit.PrintText 36,540,varb6
APToolkit.SetFont &quot;Times-Roman&quot;,18
APToolkit.PrintText 36,500,varc
APToolkit.SetFont &quot;Times-Roman&quot;,12
APToolkit.PrintText 36,480,varc1
APToolkit.PrintText 36,460,varc2
APToolkit.PrintText 36,440,varc3
APToolkit.PrintText 36,420,varc4
APToolkit.PrintText 36,400,varc5
APToolkit.PrintText 36,380,varc6

APToolkit.PrintText 36,320,vard

'=======================================Print Out Section ====================
r = APToolkit.CloseOutputFile()
zz = APToolkit.BinaryImage
response.expires = 0
response.clear
response.ContentType=&quot;application/pdf&quot;
response.AddHeader&quot;Content-Type&quot;,&quot;application/pdf&quot;
response.AddHeader&quot;Content-Disposition&quot;,&quot;inline;filename=ftppages.pdf&quot;
response.BinaryWrite zz
response.End
set APToolkit = nothing
'oBuild.Close()
%>


hope it serves as guidence

[tt]

google.gif
 
Thanks for ur support. I will try this.
Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top