The following ASP example demonstrates the ImageToPDF method, which converts an image file to PDF.
These files are required:
image.JPG - The image to convert to PDF.
ImageToPDF.ASP - Code detail provided below.
Click here to download this example (includes required files):
<%
' Define Variables
' PDF output name
varPDFName = Server.MapPath("image.pdf")
' File To Convert
varFile = Server.MapPath("image.jpg")
' Image Size
varW = 0
varH = 0
' Persist Ratio
varPersist = True
' Auto Rotation
varRotate = False
' Image Resolution
varResolution = 0
' Paper Size
varPaperSize = "LETTER"
' Image Offset
varOffsetX = 30
varOffsetY = 350
' Instantiate Object
Set APS = Server.CreateObject("APServer.Object")
' Image To PDF conversion
varReturn = APS.ImageToPDF(varFile, varPDFName, varW, varH, varPersist,_
varRotate, varResolution, varPaperSize, varOffsetX, varOffsetY)
If varReturn <> 0 Then Error("ImageToPDF") End If
' Clear Server Object
Set APS = Nothing
' Conversion Successful
Response.Write "Done!"
' Error Handling
Sub Error(Method)
Response.Write "'" & Method & "' failed with a '" & varReturn & "'"
Set APS = Nothing
Response.End
End Sub
%>
The information in this article is for the use of activePDF Customers and Evaluation Users Only. No part of this document may be transmitted or reproduced without the express written consent of activePDF.