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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating .pdf files using ASP

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi everyone!
This is the second time I'm posting this question. Hope that somebody will answer.
Here's the problem.
User fills out an HTML form, and the information enetered is to be saved as .pdf file. FileSystemObject seems can create any file, but it writes only to the text files.
Has anyone had any experience with that?
Thank you in advance.
 
Thanks Nick.
I already did. There's one available for free at

Basically, this is an SDK, which exposes one main object to work with.
But the problem for me is that after I've done everything with copying and registering necessary DLLs on a system and tried to do what I wanted, I found out that I can't open created .pdf file in browser.
The file exists and I can open it in Adobe Acrobat, but all I've got in browser is "Page cannot be displayed".
Here's a link to an article about this :

so maybe you'll get a minute and look at it and try it for yourself, so that we could compare results.

And, by the way, what are those components you were talking about? Where can I find them?

Thanks a lot.
 
Guestg (by the way, why not join Tek-Tips? You use it often enough),
Which directory are you creating the file in? Create it in the default web site's root directory. Can you access it now? If so, it's just a permissions problem. What method are you using to try to open it in a browser?

I'm not sure which components you're talking about.
[sig]<p>nick bulka<br><a href=mailto: > </a><br><a href= </a><br>Get your technical books at Bulka's Books<br>
[/sig]
 
One day I will, but I thought, that I've already joined the forum even though I'm not registered yet, because I don't only use it (this particular question is only third, that I've posted so far), but also contribute to it, posting my solutions to somebody's problems.
As for this file that I keep bothering you with, I did create it in the wwwroot directory on my computer, where I'm running PWS on NT4.
I added appropriate MIME-type through IIS Management Console to server's settings.
System recognizes .pdf and .fdf files, created by Adobe Acrobat beatifully.
But whenever I try to open it from browser I'm getting the error.
If I go to any website, which has .pdf files and click on one of them, I can see, that Acrobat Reader launches and .pdf document replaces current document in the browser's window. Even a part of Acrobat's tool bar appears underneath navigation bar of the browser.
So, I really don't know whether it's permissions or not.
Maybe it has something to with PWS, which doesn't allow out-of-process components to run from it?
But what about .pdf files on the Web that I can open?...

And components? You said, that I need to acquire some to generate .pdf files, and I just wanted to find out if know any of them.

Here's the code, which actually creates a file and contains a link to it, but whenever I click on it -- error occurs.

<%@ Language=VBScript %>
<% Response.Buffer = true%>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<%
'
' Retrieve the user responses
'
FirstName = Request.form(&quot;txtFirstName&quot;)
MI = Request.form(&quot;txtMI&quot;)
LastName = Request.form(&quot;txtLastName&quot;)
SS1 = Request.form(&quot;txtSocial1&quot;)
SS2 = Request.form(&quot;txtSocial2&quot;)
SS3 = Request.form(&quot;txtSocial3&quot;)
StreetAddress = Request.form(&quot;txtStreetAddress&quot;)
City = Request.form(&quot;txtCity&quot;)
State = Request.form(&quot;txtState&quot;)
Zip = Request.form(&quot;txtZip&quot;)
FilingStatus = Request.form(&quot;radFilingStatus&quot;)
Allowances = Request.form(&quot;txtAllowances&quot;)
Additional = Request.form(&quot;txtAdditional&quot;)
Exempt = Request.form(&quot;chkExempt&quot;)
If Exempt = &quot;on&quot; Then
Exempt = &quot;EXEMPT&quot;
Else
Exempt = &quot;&quot;
End If
'
' Create an instance of the Object
'
Set FdfAcx = Server.CreateObject(&quot;FdfApp.FdfApp&quot;)
'
' Use the fdfApp to feed the vars
'
Set myFdf = FdfAcx.FDFCreate
'
' Stuff the variables
'
myFdf.fdfsetvalue &quot;FirstName&quot;, FirstName, false
myFdf.fdfsetvalue &quot;MI&quot;, MI, false
myFdf.fdfsetvalue &quot;LastName&quot;, LastName, false
myFdf.fdfsetvalue &quot;SS1&quot;, SS1, false
myFdf.fdfsetvalue &quot;SS2&quot;, SS2, false
myFdf.fdfsetvalue &quot;SS3&quot;, SS3, false
myFdf.fdfsetvalue &quot;StreetAddress&quot;, StreetAddress, false
myFdf.fdfsetvalue &quot;City&quot;, City, false
myFdf.fdfsetvalue &quot;State&quot;, State, false
myFdf.fdfsetvalue &quot;Zip&quot;, Zip, false
If FilingStatus = 1 Then
MyFdf.fdfsetValue &quot;StatusSingle&quot;, &quot;X&quot;, false
End If
If FilingStatus = 2 Then
MyFdf.fdfsetValue &quot;StatusMarried&quot;, &quot;X&quot;, false
End If
If FilingStatus = 3 Then
MyFdf.fdfsetValue &quot;MarriedBut&quot;, &quot;X&quot;, false
End If
myFdf.fdfsetvalue &quot;Allowances&quot;, Allowances, false
myFdf.fdfsetvalue &quot;Additional&quot;, Additional, false
myFdf.fdfsetvalue &quot;Exempt&quot;, Exempt, false
'
' Point to your pdf file
'
myFDF.fdfSetFile &quot;w4.pdf&quot;
Response.ContentType = &quot;text/html&quot;
'
' Save it to a file. If you were going to save the actual file past the point of printing
' You would want to create a naming convention (perhaps using social in the name)
' Have to use the physical path so you may need to incorporate Server.mapPath in
' on this portion.
'
myFDf.FDFSaveToFile &quot;D:\inetpub\' Now put a link to the file on your page.
Response.Write &quot;<a href='
' Close your Objects
'
myfdf.fdfclose
set fdfacx = nothing
%>
</body>
</html>


Thank you for your time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top