Forum How do I...?

progress bar

lewism
Any suggestions on how to get a progress bar displayed as the pdf is being created?
mikeday
If you're writing a web application, eg. calling Prince from PHP, then I think it would be easiest to display an animated image to indicate to the user that work is in progress, such as a spinning disc or similar. Trying to display the exact time to completion requires dynamically updating the page while the existing request is in progress and is probably more effort than it is worth.

If you're writing a desktop application then the update issue becomes easier, and you can try running Prince with the --progress command-line option, which combined with the --server option will print easily readable messages giving the current progress percentage, eg. "prg|50".
jbarrus
How reliable is this? I tried doing this and my results were less than helpful.

sta|Converting document...
prg|99
prg|100
prg|99
prg|100
prg|99
prg|100
prg|99
prg|100
prg|99
prg|99
prg|100
prg|99
prg|100
prg|96
prg|96
prg|97
prg|97
prg|98
prg|99
prg|100
prg|96
prg|96
prg|97
prg|98
prg|99
prg|99
prg|100
prg|97
prg|97
prg|97
prg|98
prg|99
prg|99
prg|100
prg|98
prg|98
prg|99
prg|100
prg|99
prg|100
prg|99
prg|100
prg|99
prg|100
prg|99
prg|99
prg|100
prg|96
prg|96
prg|96
prg|98
...
prg|100
fin|success

Edited by jbarrus

mikeday
Yikes, that's not very helpful! :)

Do you have a sample document that produces this behaviour that you could email to me? (mikeday@yeslogic.com)
carl johnson
Are these command line options documented on your website? I didn't see them.
mikeday
No, not yet. :)
mikeday
Today we have released Prince 6.0 rev 8, which fixes the bug causing the progress counter to reset every time it hits a forced page break. Thanks for letting us know. :)
carl johnson
What does the
--server
option do? I would be interested in having prince running as a daemon in the background to speed up launch times, but I don't know if that's possible.
mikeday
The --server option changes the format of the output messages to make them easier to parse by a server process instead of being read by a human. We've tried keeping Prince processes running between requests, but didn't see any performance benefits relative to the increased complexity and potential for error. On Linux in particular there is not enough overhead associated with repeated process creation to make this worthwhile.
carl johnson
Thanks.
have
Many years later :-)

Has this feature been removed?

prince: error: unrecognized option `--progress'
mikeday
The --progress option has been made redundant, as --server already implies it. (And --server is actually now just a shorthand for --structured-log=progress).

Also my earlier post from 2009 may need some modification:
We've tried keeping Prince processes running between requests, but didn't see any performance benefits relative to the increased complexity and potential for error. On Linux in particular there is not enough overhead associated with repeated process creation to make this worthwhile.

For converting many very small documents the overhead of process creation can actually be a significant factor due to shared library linkage time, and we are experimenting with a new control interface to perform multiple consecutive document conversions with a single persistent Prince process.