How can I programmatically set Document Properties > Initial View?
Question: How can I programmatically set Initial View settings while running a VBA macro?
Background: I'm working on an Excel tool that includes manipulating PDFs. I'm not an experienced programmer, but I've been able to figure out how to do the following via VBA:
- Create bookmarks
- Set document properties, e.g., Title, Author, Subject, etc.
I also found code that allows me to call JavaScript code with VBA, which I'm using to run a script (by Thom Parker) to clean up bookmarks. For reference, here's the VBA I'm using to call Javascript:
If avdoc.Open(File, "") Then
'//write JS-Code on a variable
Ex = " // Put JavaScript Code here...
'//Execute JS-Code
AForm.Fields.ExecuteThisJavaScript Ex
MsgBox ("Done")
End If
Additional Details:
- It looks like I'm not able to do this with JavaScript, but is this correct? If I can set standard doc properties metadata, it seems to me that I ought to be able to set the Initial View settings??
- I read that I'm not able to run an Action programmatically -- is that, in fact, the case? I've got an Action to do what I need.
- I found lots of forum posts asking about manipulating PDFs that included responses saying, "Look at the SDK," but I've spent a ton of time looking through it but wasn't able to find anything.
- I've learned that there is a ViewerPreferences dictionary in PDFs, but I can't find anything on how to manipulate its properties. If I can manipulate the metadata in the Info Dictionary, it would seem to me that I could similarly manipulate the ViewerPreferences dictionary??
So, I'm stumped but hopeful that there is some way in which I can set Initial Settings.
Thank you!
