Date:  11/02/2004 10:23:01 AM Msg ID:  002334
From:  FoxWeb Support Thread:  002332
Subject:  Re: VBSCRIPT to FWX FOLLOW UP
If you read the last sentence of the description you posted, you will notice that "SaveHttp can only be used in an ASP/ASP.NET environment as it calls the Response.BinaryWrite method internally."

FoxWeb Support Team
support@foxweb.com email

Sent by Joe Goldsmith on 11/01/2004 10:41:31 PM:
As a follow up, here is the documentation on the code fragment
loDoc.SaveHttp "attachment;filename=hello.pdf"

?Yet another option is to save to an HTTP stream via the SaveHttp method. This method enables your Web application to send a PDF document directly to the client browser without creating a temporary copy on the server's hard drive for better performance and security.

The SaveHttp method takes two arguments, a value for the Content-Disposition header, and optionally a value for the Content-Type header. The latter value is "application/pdf" by default.

The Content-Disposition header contains the name of the PDF file as displayed to the user in the File Save As dialog box. The format for this header is:

"filename=myfile.pdf"

or

"attachment;filename=myfile.pdf"

The second version makes a browser prompt the user to save the file to disk instead of opening it in-place.

SaveHttp can only be used in an ASP/ASP.NET environment as it calls the Response.BinaryWrite method internally."

 

Joe

 

Sent by Joe Goldsmith on 11/01/2004 10:31:01 PM:
I just purchased AspPDF to print PDF files and have run into a problem. The documentation for a VBSCRIPT snippit piece of code is:
 
 <%
 Set Pdf = Server.CreateObject("Persits.Pdf")
 ' Create empty document
 Set Doc = Pdf.CreateDocument
 ' Set various document properties
 Doc.Title = "AspPDF Chapter 3 Hello World Sample"
 Doc.Creator = "John Smith"
 ' Add a new page
 Set Page = Doc.Pages.Add
 ' Select one of the standard PDF fonts
 Set Font = Doc.Fonts("Helvetica")
 ' Param string
 Params = "x=0; y=650; width=612; alignment=center; size=50"
 ' Draw text on page
 Page.Canvas.DrawText "Hello World!", Params, Font
 ' Save to HTTP stream
 Doc.SaveHttp "attachment;filename=hello.pdf"
%>
 
My code translation is:
 
<%
loPdf = CreateObject("Persits.Pdf")
* Create empty document
loDoc = loPdf.CreateDocument
* Set various document properties
loDoc.Title = "Web Cases Letters"
loDoc.Creator = "Professional Business Solutions"
* Add a new page
loPage = loDoc.Pages.Add
* Select one of the standard PDF fonts
loFont = loDoc.Fonts("Helvetica")
* Param string
loParams = "x=0; y=650; width=612; alignment=left; size=12"
* Draw text on page
loPage.Canvas.DrawText ("Hello World!", loParams, loFont)
* Save to HTTP stream
loDoc.SaveHttp "attachment;filename=hello.pdf"
%>
 
My problem is the last, bolded, line. No matter how I code it with () or whatever I keep getting either Fox syntax error or the following error message from the object:
 
"OLE IDispatch exception code 0 from Persits.PdfManager.1: Obtaining Object Context failed: There is no MTS object context "
 
Anyone have any ideas to fix this? Anyone use AspPDF?
 
Joe