Copy link to clipboard
Copied
Hi.
After Opening a PDF file, I want to set the page layout to single page.
I think maybe AVDocSetViewDefEx (AVDoc doc, ASCab viewDef) can be used,
but I don't know how to set ASCab viewDef about page layout.
And,is it possible to use AVDocOpenFromFileWithParams (ASPathName pathName, ASFileSys fileSys, const
ASText tempTitle, AVDocOpenParams params) to set page layout?
I tried to use PDDocSetLayoutMode (PDDoc doc, PDLayoutMode mode),
but the page layout not changed.
If it's possible, please show me some codes.
Best Regard.
PDDocSetLayoutMode is documented as updating the Catalog only. The Catalog is consulted when the document is opened, so this is how you set the future mode.
You could probably do this with AVDocSetViewDefEx but that requires knowing the key to use; this could be got from experimenting with the results of AVDocGetViewDefEx. However, AVDocSetViewDef (no Ex) is easier. It is marked as superseded but has not gone away and is unlikely to.
Copy link to clipboard
Copied
Do you want to set the current mode (how it will view this time, at this moment) or the future mode (how it will view next time it is opened?)
Copy link to clipboard
Copied
Yes!
I want to set the current layout mode.
Copy link to clipboard
Copied
PDDocSetLayoutMode is documented as updating the Catalog only. The Catalog is consulted when the document is opened, so this is how you set the future mode.
You could probably do this with AVDocSetViewDefEx but that requires knowing the key to use; this could be got from experimenting with the results of AVDocGetViewDefEx. However, AVDocSetViewDef (no Ex) is easier. It is marked as superseded but has not gone away and is unlikely to.
Copy link to clipboard
Copied
I have succeed in setting the page layout to single page layout with your advice.
Thank you very much.
Copy link to clipboard
Copied
I realize a deal of time has passed, but - it would have been really nice if you had shared, briefly even, how you were able to accomplish this. No disrespect intended, honestly. Any efforts that you expended in order to figure it out - which were probably non-trivial - could be quite helpful to others 🙂
I'm glad you were able to get that to work though.
It seems like it should be a matter of your preferences being respected by DC, but - that's not the case, clearly. (Preferences->Page Display -> Single, Single-continuous, etc.. don't work, and when one "updates" a document's properties to use a preferred Page-Display setting, the document's properties are not updated.
I'll try to see if I can figure out how you did it - never worked with plugins, so it'll be interesting.
Cheers.