Forum How do I...?

Newbie to Prince, installation & PHP document handling

johnfox
I'm a complete newbie to Prince and couldn't find a "101" that steps someone like me through the process of installation and actually producing a first document. Perhaps there's a link to this basis info? Thanks in advance for your assistance.

First, regarding installation, since all my website files are *.php, I'm assuming I'll run Prince from my web site where I have php 5 services available. Correct?

Second, I am not quite sure what I need to do in order to actually run Prince after I've uploaded the Price application to my (linux) server. It wasn't clear to me what additional declarations I need to add to my website files or stylesheets.
mikeday
Installing the software on Linux is a matter of downloading the .tar.gz package, extracting it with "tar xzf", and running "install.sh", possibly as root with sudo if you want to install it into a system directory like /usr/local. For example:
$ tar xzf prince-6.0r1-linux.tar.gz
$ cd prince-6.0r1-linux
$ sudo ./install.sh

Once Prince is installed, you can run it from the command-line like this:
$ prince input.html -o output.pdf

You may need to specify the absolute path if it is not installed in a system directory:
$ /wherever/you/installed/bin/prince input.html ...

What you do with Prince after you've got to this point depends on what you are trying to achieve. Do you want to make a PHP page that produces PDF files dynamically for download from your website?
johnfox
Mike, thanks for your quick response.

I want to create a PDF of my book, which is at http://www.marketing-playbook.com. Each page is a php document. It was first published in 2005 in print-form only, but I wanted to make it freely available in its web-form and then sell a PDF version. I've overhauled and updated the content on each page, so going backwards to its original InDesign format doesn't make sense to me, unless that's absolutely necessary.

Does this answer your question?
mikeday
In that case you probably don't need to call Prince from PHP, you can just generate PDF files from your PHP pages from the command-line like this:
$ prince http://example.com/mypage.php -o mypage.pdf

You can create one PDF file for each page, or combine multiple PHP pages into a single PDF by specifying multiple URLs on the command-line.
johnfox
let me backup just a bit (new to command line Unix) and make sure I'm following the proper steps.

1. Download prince-6.0r1-linux.tar.gz to my local PC
2. Upload prince-6.0r1-linux.tar.gz to my website
3. Untar prince-6.0r1-linux.tar.gz with xzf
4. Install with sudo

So let me show my ignorance. Here's my web server directory. Which folder should I upload prince-6.0r1-linux.tar.gz into? /usr or in the root or someplace else?

/
/bin
/dev
/etc
/ftp
.../usr
....../lib
........./evms
........./i686
........./locale
............/C
............/en_US
........./en_US.utf8
........./pdgconfig
........./security
........./tls
/include
/opt
/proc
/sbin
/usr
/var
.../cache
.../lib
.../lock
.../log
.../run
.../spool
.../tmp
.../www
mikeday
You might be better off testing Prince on your local machine first, just to get the hang of it, as Prince can retrieve the page that you want to turn to PDF if you specify the URL.

To install it on your website I would just upload it into a temporary directory or your home directory; do you have shell access to the machine, ie. can you telnet or ssh into it and run commands? If so, it doesn't really matter exactly where you put the archive, as after running the install script the original archive and extracted directory can both be deleted.
johnfox
Mike, thanks again for your quick response. I do have shell access and I'll give it a try.