View Full Version : PRS-500 Code to Convert PDF to Images


letkemanp
03-25-2007, 11:55 AM
With GhostScript (http://sourceforge.net/projects/ghostscript/) (http://sourceforge.net/projects/ghostscript/) & GFL SDK/GFLAx (http://perso.orange.fr/pierre.g/xnview/engfl.html) (http://perso.orange.fr/pierre.g/xnview/engfl.html) which is free you can convert PDF files to other image formats. I'm sure that GFL works with MS Visual C# Express and MS VB 2005, which are also free. The code listing below will convert the first 6 pages for FAQ.PDF to png files using vbscript. You can test it out by saving the code into a file called test.vbs and then double click on it run it.


option explicit
displaypage

sub displaypage
const AX_PNG = 3
const numofpages = 6

Dim File, ThumbNail, imagepath, i
Set ThumbNail = createobject("GflAx.GflAx")

imagepath = "c:\test.png"
File = "c:\FAQ.pdf"

With ThumbNail
for i = 1 to numofpages
.EpsDpi = 72
.Page = i
.LoadBitmap File
.Saveformat = AX_PNG
.saveBitmap replace(imagepath,"test","test" & i)
next
end with
set ThumbNail=nothing
end sub

_darius
03-27-2007, 02:06 AM
sorry, i posted this in the wrong section...

cyeung
04-19-2007, 05:25 PM
Very nice ! Thanks for the example on PDF conversion. Works like a charm.