Forum Feature requests

Generic PDF Command Addition

popcornmanager
Hi

I see you have added recently the ability to show bookmarks automatically with:

@prince-pdf {
prince-pdf-page-mode: show-bookmarks
}

What about adding support for generic PDF commands. With my previous HTML to PDF converter (which didn't cut it in most areas), you could do this. I used it to do a whole array of commands. It would also allow you to tell people to use a specific PDF string ass oppsoed to needing to come out with a new version of the product for a little feature, as long as you could make it into a command.

The commands I used were:

Show the bookmarks:
<</PageMode /UseOutlines>>

Auto-print the document:
<</OpenAction << /Type /Action /S /Named /N /Print >> >>

On open goto the first page and fit horizontally:
<</OpenAction << /S /GoTo /D [ {Page1} /FitH 800] >> >>

On open, goto the first page and fit vertically:
<</OpenAction << /S /GoTo /D [ {Page1} /FitV 0] >> >>

On open, goto the fifth page and fit vertically:
<</OpenAction << /S /GoTo /D [ {Page5} /FitV 0] >> >>

and others.


They could be set with:
@prince-pdf {
prince-pdf-command: "..."; /* or string() */
}

You would have to allow being able to set multiple commands this way.
mikeday
That's a good idea, I've added it to the roadmap. One concern might be that this would allow the user to inadvertently produce a corrupt PDF file if they get the syntax wrong, so it is a fairly advanced option. By the way, the new "prince-pdf-script" option can be used to specify JavaScript that can achieve some of these tasks, such as bringing up the print dialog automatically when the PDF file is opened.
pkmiec
In large part, we use Prince to generate printable reports for users of our web service. One of the complains we get is that it takes too many clicks to actually print. As such, I am interested in the ability to automatically bring up the print dialog.

I've tried prince-pdf-script: "this.print();". It seemed to work in IE7 when the pdf file was downloaded with inline content-disposition. However, I could not get it to work with Firefox nor Safari on the Mac.

Also, I could not find much information about this on the web. So my question is whether the prince-pdf-script method does indeed have the limitation which I experienced? How about the OpenAction method? Can you point me to any additional information on the topic?
mikeday
The scripting method works in Acrobat, but not all PDF viewers support scripting. OpenAction might be more widely supported, but we haven't implemented a property for this in Prince yet.
mikeday
And now we have! Prince 7.1 includes a new property, prince-pdf-open-action. :)