Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning an inline pdf
Message
General information
Forum:
Visual FoxPro
Category:
West Wind Web Connection
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00988459
Message ID:
00988482
Views:
58
Hi Don,

Cristof has given you the right idea here.

Couple of other things that might help:

First off Acrobat is notorious for not doing a good job of displaying dynamic URLs (ie. POSTs or Urls with querystrings) and reloading the document multiple times instead of just once. For this reason I think it's acutally better to dump your PDF to a file in a directory and then redirect to that. The Web Connection PDF sample shows how to do this.

If you do return directly, you should also add a couple of additional headers:
lcPDF = oPDF.PrintReportToString("custlist.frx")

loHeader = CREATEOBJECT("wwHTTPHeader")
loHeader.SetProtocol()
loHeader.SetContentType("application/pdf")
loHeader.AddHeader("Content-Length",TRANSFORM(LEN(lcPDF)))
loHeader.AddHeader("Accept-Ranges","bytes")
loHeader.AddHeader("Connection","Close")

Response.ContentTypeHeader(loHeader)
Response.Write(lcPDF)
This has been the most reliable way to stream PDF directly even with the older and screwed up versions of the PDF reader.

If you're using WWWC 4.60 and you're streaming from file you can also use:
loHeader = CREATEOBJECT("wwHTTPHeader")
loHeader.SetProtocol()
loHeader.SetContentType("application/pdf")
loHeader.AddHeader("Content-Length",TRANSFORM(LEN(lcPDF)))
loHeader.AddHeader("Accept-Ranges","bytes")
loHeader.AddHeader("Connection","Close")

Response.DownloadFile("d:\temp\somepdf.pdf","application/pdf",loHeader
FWIW, with most other types of files you don't need the custom headers so:
Response.DownloadFile("d:\temp\someword.doc","application/msword")
would be sufficient to send a file. DownloadFile was added in 4.60.

+++ Rick ---



>Hi all,
>
>I'm sure somebody has done this, but I'm a bit stumped... I need to generate a PDF on the fly and return to the web. I've tried a few samples I've seen and have been unsuccessful. So... to keep the dynamic generation of a PDF file simple, I have a simple 1 page PDF file already generated sitting in a temp folder (not visible via the //localhost or //www. addressable -- that's why it would be an inline return).
>
>So.. some items I've found are
>content-type: application/pdf
>content-disposition: inline
>content-length:
>
>and have even seen samples using boundary context and multi-part form-data components.
>
>Currently sampling with WC 4.15... I'm sure its something simple, but cant put my fingers on it...
>
>
>TIA
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform