I am needing to convert a large number of pdf files into jpg format. The files are located in separate folders on the server, however the folders contain a mix of pdf and jpg already. Since the database that manages the files and folders is Access 2007 it would be ideal to be able to make this conversion work using VBA. I recognize that there are dozens of freeware third party applications that can do this but I think I need more control of the process as the mix of pdf and jpg files would likely screw up batch conversions. Also, new documents being entered into the system by necessity are pdf. So in addition to a large batch process I would like to be able to convert files on the fly so that all of the files in each folder are all jpg and eliminate the collage.
I have Adobe Acrobat X installed on the server and this application can easily perform the conversion. The following code is a snippet of VB6 code that I have attempted to convert to VBA but am getting errors on several remaining lines.
Any help would be appreciated.
Dim doc As Acrobat.AcroPDDoc
Dim page As Acrobat.AcroPDPage
Dim pt As Acrobat.AcroPoint
Dim rect As Acrobat.AcroRect
Dim data As IDataObject '<===== Error in VBA
Dim bmp As Bitmap '<===== Error in VBA
doc = New Acrobat.AcroPDDoc
page = Nothing
doc.Open ("C:\Documents and Settings\tk46261\My Documents\sickdays.pdf")
page = doc.AcquirePage(0)
pt = page.GetSize()
rect = New Acrobat.AcroRect
rect.Top = 0
rect.Left = 0
rect.Right = pt.x
rect.bottom = pt.y
page.CopyToClipboard(rect, 0, 0, 100) '<===== Error in VBA
data = Clipboard.GetDataObject() '<===== Error in VBA
bmp = data.GetData(DataFormats.Bitmap) '<===== Error in VBA
bmp.Save ("C:\Documents and Settings\tk46261\Desktop\Print Excel To JPG\test.jpeg") '<===== Error in VBA