Forum How do I...?

Details on setting PDF properties

jerkob
I have a few questions regarding setting PDF properties that aren't clear from the documentation.

1. What is the correct way to set PDF properties in JavaScript, by assignment or as a parameter? For example, which of the following is correct:

Option 1:
PDF.pageMode('fullscreen')


Option 2:
PDF.pageMode = 'fullscreen'


2. Does it matter at which point PDF properties are set via JavaScript? As I see it there are three options, are these all the same?

Option 1:
<script>
    PDF.pageMode = 'fullscreen'
</script>


Option 2:
<script>
function setPageMode() {
    PDF.pageMode = 'fullscreen'
}

window.addEventListener("load", setPageMode, false);
</script>


Option 3:
<script>
function setPageMode() {
    PDF.pageMode = 'fullscreen'
}

Prince.addEventListener("complete", setPageMode, false);
</script>



3. If I set a PDF property in CSS and then also in JavaScript, which will take effect? For example, what will be the page mode in this scenario (assuming the JavaScript is run):

CSS:
prince-pdf-page-mode: show-bookmarks


JavaScript:
PDF.pageMode = 'fullscreen'

Edited by jerkob

mikeday
The PDF properties are set by assignment:
PDF.pageMode = 'fullscreen';

Option 1 and 2 will both work, but for option 3 the oncomplete event is too late to specify PDF properties (although this may change in future versions of Prince).

Currently I think the CSS property may override the JavaScript, but this should not be relied upon and may change in future releases, as you would expect it to be the other way around.