ActivePDF
Shopping Cart My Account Help Contact Us
Request a Call
Search
Products Solutions Support Downloads Corporate
Submit an Issue
Knowledge Base
Server Product Support
Examples & How-Tos
Support Options
Support Policies
Annual Subscription
Extensions
Documentation
Resource Links
   
 
 
 
 

HomeSupportKnowledge Base
 
activePDF KB #10553 - Convert an Image to PDF using Server
activePDF KB #10553 - Convert an Image to PDF using Server
Information: Example Printer Version | Return to Search
Convert an Image to PDF using Server
 
Product Version Code Samples    
Server
3.5.2
VBS
ASP
CF
 
Description
 
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
%>
 
Keywords
 
imagetopdf, server, activepdf, image, jpg, tiff, gif, to, pdf, method, methods, property, properties, asp, cfm, cf, coldfusion, cold, fusion, VBS, VBScript, vb, script, example, sample
 
Last Updated 2005-11-09 Printer Version | Return to Search
 
Knowledge Base Article Feedback*
*KB article feedback ONLY (submit support issues here)
Quality of this article?
  Poor Excellent 
1 2 3 4 5 6 7 8 9 10
Is this article helpful? Yes       No       Maybe
Comments (Optional)
Email Address (Optional)
Please enter the word "PDF"
(without quotes)
 
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.

Copyright © 2005, activePDF, Inc. All Rights Reserved
2003 activePDF Site Map Feedback Privacy Policy Legal