View Single Post
Old 03-25-2007, 10:55 AM   #1
letkemanp
Junior Member
letkemanp began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2007
Location: Canada
Device: Sony Portable Reader
Code to Convert PDF to Images

With GhostScript (http://sourceforge.net/projects/ghostscript/) & GFL SDK/GFLAx (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.

Code:
  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
letkemanp is offline   Reply With Quote