Convert PART of PDF page to jpeg? (1 Viewer)

CedarTree

Registered User.
Local time
Today, 13:16
Joined
Mar 2, 2018
Messages
404
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!!!
 

CedarTree

Registered User.
Local time
Today, 13:16
Joined
Mar 2, 2018
Messages
404
Actually, for now, I'll even take just saving out a PDF page to a jpeg
 

CedarTree

Registered User.
Local time
Today, 13:16
Joined
Mar 2, 2018
Messages
404
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:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 12:16
Joined
Feb 28, 2001
Messages
27,272
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?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:16
Joined
Feb 19, 2002
Messages
43,409
Let's step back. There is nothing related to Access in your request. Are you trying to automate this process from Access so you are looking for a VBA solution. Because it is pretty trivial using the snipping tool in windows.

Did your Access application produce the .pdf? If so, you can produce a separate file with just the subreport in it. That may lead you to a solution using a windows scripting language that you might be able to automate from Access.
 

Users who are viewing this thread

Top Bottom