How to Save a PDF Page as a JPG Using VBA and Adobe Acrobat
Question details
The user wants to automate saving a specific PDF page as a JPG image using a VBA script in conjunction with Adobe Acrobat.

- Product
- VBA / Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Developing an automation script in VBA (e.g., via Excel or Access) to process PDF files and extract or save their pages as JPG images.
- Observed behavior
- The standard Acrobat Save method successfully handles PDF document saving but fails when the user attempts to specify JPG as the output format type.
Ensure you have Adobe Acrobat Pro installed, as Adobe Acrobat Reader does not support the necessary export APIs. You must also enable the Acrobat library references in your VBA editor.
Use the Acrobat JavaScript Object (JSObject) in VBA
Since Acrobat's standard VBA Save method does not support image export, you can bridge VBA to Acrobat's internal JavaScript engine to utilize the JS SaveAs method.
Acrobat's core Object Linking and Embedding (OLE) API is limited in direct file conversion types. However, Adobe exposes a JavaScript Object (JSObject) to external applications. By calling this object in VBA, you can access the Acrobat JavaScript 'SaveAs' method, which supports converting pages to 'com.adobe.acrobat.jpeg'.
Open your VBA editor, create an Acrobat Application object (`AcroApp`), and load the target PDF file using the `AcroPDDoc` object.
Retrieve the JavaScript bridge by declaring a generic Object variable and assigning it the document's JSObject (e.g., `Set jso = pdDoc.GetJSObject`).
Invoke the `SaveAs` command through the JSObject. You must pass two arguments: the destination file path (with a .jpg extension) and the conversion identifier `"com.adobe.acrobat.jpeg"`.
Once the export completes, close the PDF document without saving changes and properly set your VBA object variables to 'Nothing' to free up system memory.

Use an External Command-Line PDF-to-Image Utility
If Acrobat Pro is unavailable or the JavaScript bridge proves too complex, you can trigger a third-party command-line utility directly from your VBA script.
Convert PDF to JPG Seamlessly with WPS Office
Skip complex VBA scripting and Acrobat API limitations. WPS Office includes a powerful, built-in PDF to Picture tool that lets you export high-quality JPGs from your PDF documents without writing a single line of code.
- 1. Open your PDF: Launch WPS Office and open the PDF document you wish to convert.
- 2. Access the Tools Menu: Navigate to the 'Tools' tab located on the top ribbon of the WPS PDF interface.
- 3. Select PDF to Picture: Click the 'PDF to Picture' button to open the export dialogue window.
- 4. Configure Output Settings: Choose 'JPG' as your desired output format. You can also adjust the image quality, watermark settings, and select specific pages.
- 5. Export Images: Click 'Export' to immediately save your PDF pages as individual JPG files to your chosen folder.

Frequently Asked Questions
Why does the standard Acrobat Save method fail for JPGs in VBA?
The core OLE automation object for Acrobat (`AcroPDDoc`) was primarily designed for PDF manipulation and structural saving. It does not inherently load the image conversion plugins required to output a JPG, which is why you must route the request through Acrobat's internal JavaScript engine.
Can I export multiple PDF pages to JPG using the JSObject in VBA?
Yes. When you use the JavaScript 'SaveAs' method on a multi-page PDF document, Acrobat automatically exports all pages. It appends a sequential number to the base filename you provide (e.g., output_1.jpg, output_2.jpg).
What is the correct conversion identifier for PNG format in Acrobat JavaScript?
If you wish to save the PDF page as a PNG instead of a JPG, you should replace 'com.adobe.acrobat.jpeg' with 'com.adobe.acrobat.png' in the JSObject SaveAs arguments.
Do I need Adobe Acrobat Pro to use these VBA scripts?
Yes. Adobe Acrobat Reader does not include the OLE automation API or the necessary document manipulation libraries required to save PDFs in alternate formats via VBA.




