Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

Can I add an image to PDF file using Quick PDF Library Lite?

Question

Can I add an image to PDF file using Quick PDF Library Lite?

Answer

Yes, the AddImageFromFile and DrawImage functions are available in Quick PDF Library Lite. Here is some basic VBScript sample code that you can use to add an image to a PDF:

Dim ClassName
Dim QP

Dim OriginalPDF
Dim UpdatedPDF
Dim lWidth
Dim lHeight   

ClassName = "QuickPDFLite0718.PDFLibrary"
OriginalPDF = "original.pdf"
UpdatedPDF = "original_updated.pdf"
NewImage = "image.png"

Set QP = CreateObject(ClassName)

//' Load the PDF that you want to add the image to
Call QP.LoadFromFile(OriginalPDF)

//' Load the image that you'd like to add to the PDF
Call QP.AddImageFromFile(NewImage, 0)

//' Get the width and height of the image
lWidth = QP.ImageWidth()
lHeight = QP.ImageHeight()

//' Draw the image onto the page using the the images
//' height and width. The image will be drawn in the
//' top right hand corner of the page.
Call QP.DrawImage(0, QP.PageHeight, lWidth, lHeight)

//' Save the new PDF to disk
If QP.SaveToFile(UpdatedPDF) = 1 Then
WScript.Echo("File " + UpdatedPDF + " written successfully")
Else
WScript.Echo("Error, file could not be written")
End If

Set QP = Nothing

© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum