Copy link to clipboard
Copied
I am working on creating a vba script (Excel) that will create a pdf and fix the width of the document to size of the view port. I reviewed the Interapplication Communication API Reference documentation that list all of the methods and properties of the api. I want to use the “SetPreferenceEx” method to set the Zoom preference to a value of Fit Width. In the instructions (page28), the method provides the data type and description of the parameters. The first parameter is expecting an application preference to be provided, for example, I would expect to be able to pass “Zoom” into this parameter. I have been unsuccessful in trying to set this parameter. The description says to go to the Acrobat and PDF Library API reference for a list of preference items. I found the document here , the issue I am having is that document has over 6,000 pages and I have been unsuccessful in finding the list of preferences. I was hoping you could provide me with a cheat sheet or a page number of where I can locate the list.
Remember that preferences just change the viewer that you are targeting – it does not change the PDF. So that any else viewing the document will see their preference view.
Copy link to clipboard
Copied
Is zoom cruelly s preference? Where would you set it it Edit >Preferences, and would setting to do the job you want?
Copy link to clipboard
Copied
Sorry, Is zoom really a... dang autocorrect
Copy link to clipboard
Copied
Remember that preferences just change the viewer that you are targeting – it does not change the PDF. So that any else viewing the document will see their preference view.
Copy link to clipboard
Copied
Thank you for the response. I was hoping there would be away to alter the users preferences but that didn't really make sense. Our team will have to decide if its worth increase the size of the font to increase the readability of the pdf.
Copy link to clipboard
Copied
I don't understand the problem. If things are too small, why not just zoom?
Copy link to clipboard
Copied
Our team was trying to avoid having the user zoom in. I agree I would just zoom in as well.
Copy link to clipboard
Copied
So, why not zoom in for the user? Or set the document open options so they don't have to?
I don't quite follow the path from this problem which led you to wanting to edit Preferences?
Copy link to clipboard
Copied
Are you saying there is a method I can use to set the zoom factor for the user? I would like for when the user opens the pdf its set to the zoom factor that was established when the macro executed said code.
Copy link to clipboard
Copied
I am using Excel VBA to create the pdf, so Ideally I wanted the zoom to be set at the time the pdf is created. So, when the user opens the pdf the zoom is set to the value that was used at the time of creation.
Copy link to clipboard
Copied
AVPageViewZoomTo may be your friend.
Copy link to clipboard
Copied
Its funny you mention that method. The original code I had was using this method. I would open the document and then zoom in and save the document. I found the snippet online and some minor modifications to zoom in. The problem is the pdf when saved doesn't retain the zoom in factor.
Dim AcroApp As CAcroApp
Dim AVDoc As CAcroAVDoc
Dim PDDoc As CAcroPDDoc
Dim PPageView As CAcroAVPageView
Set AcroApp = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")
pdfFileName = "C:\Users\csmith\Desktop\Metrics\Commercial Quote Builder.pdf"
Call AVDoc.Open(pdfFileName, "")
Set AVDoc = AcroApp.GetActiveDoc
If AVDoc.IsValid Then
Set PDDoc = AVDoc.GetPDDoc
Set PPageView = AVDoc.GetAVPageView
PPageView.ZoomTo 4, 1
PDDoc.Save PDSaveFull, "C:\Users\csmith\Desktop\Metrics\Commercial Quote Builder.pdf"
PDDoc.Close
End If
'Close the PDF
AVDoc.Close True
AcroApp.Exit
'Cleanup
Set PPageView = Nothing
Set PDDoc = Nothing
Set AVDoc = Nothing
Set AcroApp = Nothing
Copy link to clipboard
Copied
No, it wouldn't. It just zooms. Have you considered the "Restore last view settings when reopening documents" preference, if that is acceptable to your users (remember, if they reopen the PDF it will open it not where you closed it but where THEY closed it).
Copy link to clipboard
Copied
I talked to the person that requested this and they're ok with fixing the zoom. In the future, I will work on making the size of objects on the page dynamic based on the amount of content so we don't have empty space. The solution doesn't account for the size of the content so we have the font size set to a small size so we don't have objects overlapping. I appreciate your help today .