Example of Image

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
chrisM
Posts: 13
Joined: Wed Oct 01 2003

Example of Image

Post by chrisM »

Hi,

Could someone please give me an example (in VB/VB.NET/C#) of how to create pdf file containing a single image(a scan of an a4 page) which fills the entire page.

I am trying to use the following code, but when I try and open the file in Acrobat, I get the message: "Wrong Operand Type".

.AddPage(1)
.CreateObject(ObjectTypeConstants.acObjectTypePicture, "pic1")
.ObjectAttribute("pic1", "FileName") = "C:\testdoc.bmp"
.ObjectAttribute("pic1", "Page") = 1
.RedrawObject("pic1")
.Save("C:\AmyuniPDf.pdf",FileSaveOptionConstants.acFileSaveAll)

Hope someone can help
Thanks in advance,
Regards,


Chris.
DanielBordeleau
Posts: 21
Joined: Tue Apr 29 2003
Location: Montreal, Quebec

Post by DanielBordeleau »

You have to set dimensions for your picture object :

.AddPage(1)
.CreateObject(ObjectTypeConstants.acObjectTypePicture, "pic1")
.ObjectAttribute("pic1", "FileName") = "C:\testdoc.bmp"
.ObjectAttribute("pic1", "Page") = 1

-- ADD THIS HERE
.ObjectAttribute("pic1", "LEFT") = 0
.ObjectAttribute("pic1", "TOP") = 0
.ObjectAttribute("pic1", "RIGHT") = Me.objPDF.PageWidth
.ObjectAttribute("pic1", "BOTTOM") = Me.objPDF.PageLength
-----------------------------------------------------

.RedrawObject("pic1")
Post Reply