Print Page | Close Window

convert gif to pdf

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1615
Printed Date: 12 May 24 at 10:25PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: convert gif to pdf
Posted By: abenitez77
Subject: convert gif to pdf
Date Posted: 25 Oct 10 at 12:00PM

I have 100,000 gif images and I want to convert them all to pdf files.  How can i do this in a script?




Replies:
Posted By: Rowan
Date Posted: 25 Oct 10 at 6:05PM
Converting GIF images to PDF files can be done relatively easily. Here's a sample written in JScript:

-------------------------------------------------------
/* Convert an image to a PDF */

// Load a sample image into memory

QP.AddImageFromFile("sample123.gif", 0);

// Get the width and height of the image

lWidth = QP.ImageWidth();
lHeight = QP.ImageHeight(); 

// Reformat the size of the page in the selected document 

QP.SetPageDimensions(lWidth, lHeight);

// Draw the image onto the page using the specified width/height

QP.DrawImage(0, lHeight, lWidth, lHeight);

// Store the updated PDF where you like

QP.SaveToFile("sample123.pdf");
-------------------------------------------------------

All you have to do is loop through this little snippet of code for each image that you wish to convert.


Posted By: abenitez77
Date Posted: 25 Oct 10 at 8:09PM
Thanks!
I am unfamiliar with jscript.  If I had a folder "e:\images" and wanted to loop thru the gif files in that dir, what is the syntax? 


Posted By: abenitez77
Date Posted: 25 Oct 10 at 8:11PM
How would i kick that script off?  do I need to run in from within quickpdf?


Posted By: Wheeley
Date Posted: 26 Oct 10 at 7:27AM
It might help if you tell us which programming language you are trying to use.

Wheeley


Posted By: abenitez77
Date Posted: 26 Oct 10 at 11:45AM
I am familiar with vbscript and vba


Posted By: Rowan
Date Posted: 26 Oct 10 at 8:58PM
There is some samples on how to use Quick PDF Library with VBScript in this folder (after you've installed Quick PDF Library):

C:\Program Files\Quick PDF Library\Samples, Tutorials and Help\VBScript

It should not be very hard to convert the JScript code that I posted into VBScript, just a few minor changes like removing the semi-colons from the end of the lines and a few other things.

As for looping through each image in the folder, off the top of my head I'm not familiar with how to do this in VBScript, but you should be able to find a sample in Google.

Good luck!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk