View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
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