Frequently Asked Question:
Convert image to PDF
Question
Can I convert images to PDF files using Quick PDF Library?
Answer
Yes, Quick PDF Library supports the conversion of images to PDF files.
It is possible to convert TIFF, JPG, BMP, GIF, EMF, WMF and PNG images to a new PDF or overlay the image onto an existing PDF. Here is some sample code that demonstrates how to convert an image to a new PDF.
VB6 Sample Code
Private Sub btnConvertImageToPDF_Click()
Dim QP As QuickPDFAX0719.PDFLibrary
Set QP = CreateObject("QuickPDFAX0719.PDFLibrary")
Dim LicenseKey
Dim ImageName
Dim OutputFile
LicenseKey = "..." //' SET YOUR LICENSE KEY HERE...
ImageName = "C:\Temp\Winter.jpg"
OutputFile = "C:\Temp\Winter.pdf"
Dim Result
Result = QP.UnlockKey(LicenseKey)
If Result = 1 Then
//' Load the image that you'd like to add to the PDF
QP.AddImageFromFile ImageName, 0
//' Get the width and height of the image
lWidth = QP.ImageWidth
lHeight = QP.ImageHeight
//' Set new document page size
QP.SetPageDimensions lWidth, lHeight
//' 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.
QP.DrawImage 0, QP.PageHeight, lWidth, lHeight
//' Save the new document to disk
QP.SaveToFile OutputFile
Else
MsgBox "Invalid license key. Please set your license key by editing this file."
End If
End Sub