Convert acrobat 9.0 PDF to Image .PNG Using VBA Code (4 Viewers)

Dvorak Pietrek

New member
Local time
Today, 05:28
Joined
Sep 6, 2025
Messages
9
Hi everyone!

Could someone please help me convert a PDF file to PNG format using Acrobat? I want to open the file with Acrobat 9.0 and then convert or export it to PNG format. If you could provide me with a simple VBA example, I would be very grateful. Please, keep it simple as I'm new to this kind of programming.
 
Hi everyone!

Could someone please help me convert a PDF file to PNG format using Acrobat? I want to open the file with Acrobat 9.0 and then convert or export it to PNG format. If you could provide me with a simple VBA example, I would be very grateful. Please, keep it simple as I'm new to this kind of programming.
What exactly have you tried so far? Do you have a copy of Adobe Acrobat 9.0 already? Have you investigated whether it even has that capability?

VBA is a Microsoft Office product. Does Acrobat 9.0 even use VBA?
 
What exactly have you tried so far? Do you have a copy of Adobe Acrobat 9.0 already? Have you investigated whether it even has that capability?

VBA is a Microsoft Office product. Does Acrobat 9.0 even use VBA?
If I'm asking, it's because I have Acrobat. I have the full version of Acrobat and have used VBA before. Read what I posted and you'll see what I need.
 
You might be able to do it using a shell command to open the file with acrobat and save as a png. I don’t use acrobat so refer to the acrobat documentation

Perhaps ChatGPT can help
 
Well done @xavier.batlle

Did you get that from a Google?, that is what I would do.
Yes, I found it on my Google search first page.
I also read it's possible to achieve it using PPT automation (Not tested):

Code:
Sub SavePDFAsPng(sPathToPDF As String, sPathToPNG As String)
Dim oPres As Presentation
Dim oSh As Shape
' Height/Width are hardcoded here
' You could get trickier and bring the PDF into any presentation
' once to get its proportions, delete it, set the slide size to the same
' proportions, then re-insert the PDF
Dim sngWidth As Single
Dim sngHeight As Single

    sngWidth = 612
    sngHeight = 792
    Set oPres = Presentations.Add
    With oPres
        With .PageSetup ' set it to 8.5x11
            .SlideHeight = sngHeight ' 11in * 72 points per inch
            .SlideWidth = sngWidth
        End With
        .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)

        With .Slides(1)
        Set oSh = .Shapes.AddOLEObject(0, 0, sngWidth, sngHeight, , sPathToPDF)
        Call .Export(sPathToPNG, "PNG")
        End With
        .Saved = True
        .Close

    End With
End Sub

Sub TestSavePDFAsPng()
    Call SavePDFAsPng("C:\Temp\MyTest.pdf", "C:\Temp\MyTest.PNG")
End Sub
 
This function uses PPT automation in MS ACCESS to convert A PDF to a PNG file. No Acrobat needed. (Tested) :

Code:
'Set a reference to the Microsoft PowerPoint xx.0 Object Library:
'In the VBA editor (press Alt + F11),
'Go to Tools > References...,
'Find and check Microsoft PowerPoint xx.0 Object Library (where xx depends on your Office version)
'Example: Microsoft PowerPoint 16.0 Object Library (Office 365)

Sub SavePDFAsPng(sPathToPDF As String, sPathToPNG As String)
Dim ppApp As PowerPoint.Application
Dim oPres As PowerPoint.Presentation
Dim oSh As Shape
' Height/Width are hardcoded here
' You could get trickier and bring the PDF into any presentation
' once to get its proportions, delete it, set the slide size to the same
' proportions, then re-insert the PDF
Dim sngWidth As Single
Dim sngHeight As Single

    sngWidth = 612
    sngHeight = 792
  
    ' Start PowerPoint
    Set ppApp = New PowerPoint.Application

    Set oPres = ppApp.Presentations.Add
    With oPres
        With .PageSetup ' set it to 8.5x11
            .SlideHeight = sngHeight ' 11in * 72 points per inch
            .SlideWidth = sngWidth
        End With
      
        .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)

        With .Slides(1)
            Set oSh = .Shapes.AddOLEObject(0, 0, sngWidth, sngHeight, , sPathToPDF)
            Call .Export(sPathToPNG, "PNG")
        End With
        .Saved = True
    End With
  
    Set ppApp = Nothing
 
End Sub

Sub TestSavePDFAsPng()
    Call SavePDFAsPng("C:\Tmp\MyTest.pdf", "C:\Tmp\MyTest.PNG")
End Sub
 

Users who are viewing this thread

Back
Top Bottom