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

Trouble with ActivePDF

Status
Not open for further replies.

tboston

Programmer
Dec 24, 2001
12
0
0
US
I am using ActivePDF toolkit to generate a pdf document with form fields containing information obtained from a database. The code i have basically comes straight from their product documentation and looks like this:

set toolkit = CreateObject("APToolkit.Object")
r = toolkit.openoutputfile("MEMORY")
r=toolkit.newpage
r = toolkit.MergeFile("d:\dprweb\lic_app\deficiency\defnotice3502b.pdf",0,0)
toolkit.CloseOutputFile
x = toolkit.OutputBytestream()
r = toolkit.OpenOutputFile("output.pdf")
toolkit.InputByteStream = x
r = toolkit.OpenInputFile("MEMORY")

toolkit.SetFormFieldData "Name",Name,-998 'here is name
toolkit.SetFormFieldData "Address1",Address1,-998 'here is address1
toolkit.SetFormFieldData "Address2",Address2,-998 'here is address2
toolkit.SetFormFieldData "Address3",Address3,-998 'here is address3
toolkit.SetFormFieldData "Liaison",Liaison,-988 'here is liaison
toolkit.SetFormFieldData "LEmail",LEmail & ".",-998 'here is liaison
toolkit.SetFormFieldData "Pro_name",Pro_name,-998 'here is profession
'set up loop to display deficiencies
count = 0
do while not rstdefc.EOF
count = count + 1
description_text=trim(rstdefc("description_text"))
charlength = len(description_text)
histcomment=rstdefc("histcomment")
if mid(description_text,charlength,1) = "." then
Description = description_text & " " & histcomment
else
if mid(description_text,charlength,1) = "$" then
Description = description_text & " " & histcomment
else
if mid(description_text,charlength,1) = "#" then
Description = description_text & " " & histcomment
else
if mid(description_text,charlength,1) = ":" then
Description = description_text & " " & histcomment
else
Description = description_text & " " & histcomment
end if
end if
end if
end if

toolkit.SetFormFieldData "Description_Text" & cstr(count),Description,-998
rstdefc.MoveNext
loop
r = toolkit.copyform(0,0)
toolkit.CloseOutputFile

set toolkit=nothing

It appears as though the document is being generated but it is not viewable when i use this HREF statement for the viewer to click on and view the document:

Response.Write(&quot;<a href =&quot; & x & &quot;><b>Click to view and print Deficiency letter.</b></a> &quot;)

What happens in the browser is that a bunch of numbers and possibly ascii coding appears in the area where you would have the viewer click to view the pdf.

Has anyone else experienced this problem when trying to generate a pdf document from memory using activePDF toolkit?

tia,
 
Nope, i'm receiving the same results.
 
We use activePDF at work however we haven't had cause to use the toolkit yet.

Does the
Response.Write(&quot;<a href =&quot; & x & &quot;><b>Click to view and print Deficiency letter.</b></a> &quot;)
line come out of the documentation?

My guess is you're writing the actual PDF formatted text directly into the href (where you have the x variable), which I couldn't imagine working.

Totally guessing here, but why not try putting the PDF output (x) into a hidden form variable, submitting the form to a new (or same) page, checking before writing any HTML for a value (len>0) in that form variable, and if so response.write'ing it to the page (after a MIME thingie to tell it it's PDF). codestorm
Fire bad. Tree pretty. - Buffy
Hey, I'm operating on a limited mental budget here.
<insert witticism here>
 
Yes, i believe that is exactly what is happening. Here is what we did in response to previous:

if len(request(&quot;x&quot;)) > 0 then
response.write x
response.end
else
end if

and then submit to the same page:

<form name=submitpdf method=post action=create_public_letter.asp>
<a href =&quot; javascript:document.submitpdf.submit()&quot;>open pdf document</a>
<input type = &quot;hidden&quot; name = &quot;x&quot; value = <%= r %>>
</form>

and what we get is a blank page in the browser...with no attempt to open adobe reader. I'm now completely lost!!!
 
Are you response.write'ing x to the page before any HTML?
What appears in the page source (from the browser)?
I imagine you'll have to tell it what MIME type it is before response.write'ing x. codestorm
Fire bad. Tree pretty. - Buffy
Hey, I'm operating on a limited mental budget here.
<insert witticism here>
 
do you mean like this?

response.write (&quot;<OBJECT id=&quot;&quot;application/pdf&quot;&quot;>&quot;)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top