Convert PART of PDF page to jpeg?

CedarTree

Registered User.
Local time
Today, 18:35
Joined
Mar 2, 2018
Messages
449
Anyone have code to convert just a part of a PDF page to a jpg file? I know the PDF coordinates within the page I want to save. Thanks!!!
 
Actually, for now, I'll even take just saving out a PDF page to a jpeg
 
EDIT: I think maybe Acrobat DC (the pro version) is not recognizing the code I'm using.
Here's a link to similar code that's also not now working: https://myengineeringworld.net/2013/03/vba-macro-to-convert-pdf-files-into.html

Here's some code that used to work for me but now I get an error.

Code:
sImageFileName = "Image_test.jpg"
sImageFullFileName = csImagePath + sImageFileName
boResult = mobjJSO.SaveAs(sImageFullFileName, "com.adobe.acrobat.jpeg", , False, False)

1677592481172.png
 
Last edited:
First, a disclaimer: I know NOTHING about the internal structure of a .PDF - so I'm talking general principles here, no specifics.

The general way to research this kind of error involves certain steps, in no particular order.

1. Verify - from any VBA code pages using Tools >> References to get to the reference library list - that you have no missing or broken library links. If so, fix them. (Simplest method is uncheck, close, then go back there a second time and find the correct reference, then check it.)

2. Put a breakpoint on the line that gives you the error. The code stops BEFORE it executes the breakpointed line. Hover your cursor over each argument OR open the Immediate Window and perform a DEBUG.PRINT on your variable. See if any variable isn't what it should be.

3. Verify using whatever documentation you have that your call contains the correct variables, correct KINDS of variables, and that any blank spots have justification for being blank/omitted.

4. "used to work but now I get an error" - doesn't happen without cause. Can you tie this failure to a particular date?

4.a If so, by any chance does that date fall on a Wednesday? (Because Microsoft's automatic Windows Updates occur on Tuesdays at or about midnight.) If you have a good handle on the date it started, you can go to the Start >> Settings >> Update & Security and see that update history to confirm an update that evening. If it is recent enough, you can roll back that update.

4.b If not, did you make any changes in another part of the code that might have a side-effect in the code that is failing?
 

Users who are viewing this thread

Back
Top Bottom