Help with dependencies config

Hello! Looking for some guidance with the dependencies config for Pressbook export options. I have a client that need exports for pdf and MOBI. If there is any more info someone would need to help, please let me know. Here is what I have so far.

  • Clean install of wordpress, clean install of Pressbooks.

  • mPDF via git on the command line, activated it in wordpress
    (now I see a pressbooks-mpdf directory in wp-config/plugins)

  • downloaded KindleGen tarball, unziped in wp-config/plugins

  • the server already has xmllint installed, so I used that path for the wp-config (listed below)

  • added the following lines to wp-config.php:
    define( ā€˜PB_KINDLEGEN_COMMANDā€™, ā€˜/home/classicchapters/www/cgi-bin/kindlegen/kindlegenā€™ );
    define( ā€˜PB_XMLLINT_COMMANDā€™, ā€˜/usr/bin/xmllintā€™ );

When we try to export a pdf, only the mPDF export option is available, is this correct? Should the others be available too? However, the main problem is that when we try to export pdf, we get the following error: ā€œEventStream Connection Errorā€ How do I correct this?

Kindlegen (MOBI) format is greyed out, cannot select it. Ive read a few other topics on the forum that say epubcheck is required for this to work. Is that correct?

If so, I placed the epubcheck files on in the servers cgi-bin, however, java is not available on the server. Is there an alternative to running epubcheck?

We have an option to upgrade the server package to get java. If we do that, is this as simple as placing this line in the wp-config?
define( ā€˜PB_EPUBCHECK_COMMANDā€™, ā€˜/usr/bin/java -jar /home/classicchapters/www/cgi-bin/epubcheck-4.2.1/epubcheck.jarā€™ );

ā€¦and then everything will work?

Many thanks in advance for your help. I have a feel we are very close to getting this to work, just a few pieces need to fall in place. If there is any more information you need, please let me know.

Thanks.

I have an update to this, still looking for some assistance.

We upgraded our server, now have java. Wordpress and Pressbooks install complete. Here is what Iā€™ve done:

  • activated mPDF plugin
  • unziped kindlegen
  • unzipped epubcheck
  • xmllint already on the server
  • unzipped saxon

Placed the following lines in wp-config:

define( ā€˜PB_KINDLEGEN_COMMANDā€™, ā€˜/home/classicchapters/www/cgi-bin/kindlegenā€™ );
define( ā€˜PB_EPUBCHECK_COMMANDā€™, ā€˜/usr/bin/java -jar /home/classicchapters/www/cgi-bin/epubcheck/epubcheck.jarā€™ );
define( ā€˜PB_XMLLINT_COMMANDā€™, ā€˜/usr/bin/xmllintā€™ );
define( ā€˜PB_SAXON_COMMANDā€™, ā€˜/usr/bin/java -jar /home/classicchapters/www/cgi-bin/saxon/saxon9he.jarā€™ );

The pdf export still fails with an ā€œEventStream Connectionā€ error. The MOBI format is still greyed out. See screenshot.

Any help would be greatly appreciated.

I have a similar problem to yourself with the mPDF plugin. I hadnā€™t used my Pressbooks installation on my desktop for a while and decided to update both Wordpress and the pressbooks plugin, and ended up making a complete reinstallation after making a mistake. After the reinstall all of the export options were available apart from pdf for print and for digital. These two options were greyed out, Iā€™m assuming they are only available if Prince is installed. When I tried to export to pdf with the mPDF option checked I got the same result as yourself. Iā€™ve come to the conclusion that since mPDF is not now maintained since earlier this year it is incompatible with the latest press books plugin. Iā€™m not sure now if I need to or can downgrade the Pressbooks plugin to an earlier version which works with mPDF.

mPDF was a community contributed plugin. I think long term you are going to be much happier with Prince exports.

mPDF creates functional exports, Prince PDF clones all of the work you have done to make your ebook look exactly the way you want it to and puts that into the PDF version.

Prince is a paid application, and many people in open community use the non commercial license that only requires we credit PrinceXML on our website. An alternative is to use DocRaptor for your PDF exports. DocRapter is just a web version of Prince.

Your Converters look very similar to mine with a few key details different:

define( ā€˜PB_PRINCE_COMMANDā€™ , ā€˜/usr/bin/princeā€™ );

define( ā€˜PB_XMLLINT_COMMANDā€™ , ā€˜/usr/bin/xmllintā€™ );

define( ā€˜PB_EPUBCHECK_COMMANDā€™ , ā€˜/usr/bin/java -jar /usr/bin/epubcheck/epubcheck.jarā€™ );

(my note: I moved epubcheck into the usr/bin/ so that it was similar to the examples on the directions page.)

define( ā€˜PB_KINDLEGEN_COMMANDā€™ , ā€˜/usr/bin/kindlegen/kindlegenā€™ );

(My note: notice that kindlegen is repeated twice, once for the folder and once for the command, and that I moved it into the opt folder.)

define( ā€˜PB_SAXON_COMMANDā€™ , ā€˜/usr/bin/java -jar /opt/saxon-he/saxon9he.jarā€™ );

(my note: I moved this into the opt folder to be like the examples in the direction sheet)

I remember this being a long and frustrating part of setup, but once it was working the first time, I have never had to do anything with these again. I hope you get through it.

1 Like

@beckej Thanks for you help. I was able to get some of the dependecies working, just not Prince (so far). My main problem is that php on my server was not allowed to run exec(). Getting that turned on allowed for epubcheck and kindlegen to work.

mPDF was still not working, so I bailed on it and am trying to get Prince installed, but no luck. So far, I have downloaded the 32 bit linux version unzipped it, and put its path into wp-config.

define( ā€˜PB_PRINCE_COMMANDā€™, ā€˜/home/classicchapters/www/cgi-bin/prince/bin/princeā€™ );

ā€¦but Im still not getting the pdf options on export to work.

Any ideas?

Jeremy,

It isnā€™t something stupid is it? Should there be a space between the close parenthesis and the comma after ā€˜PB_PRINCE_COMMANDā€™ ,

The way prince works is it takes the XHTML export, and then converts that to the PDF. For that reason prince relies on xmllint to validate the xhtml to make sure it is ready.

  1. Iā€™d go to the pressbooks diagnostics page and make sure pressbooks is detecting xmllint.

  2. If that works I would just check that I have a license file installed for Prince. The non commercial license of Pressbooks works from the command line without a license file (if there is no license the command line is able to assume it is non commercial. Pressbooks on the other hand still needs a license either way.)

Check your license by running something along the lines of.
/usr/bin/prince --version

It should actually say something along the lines of non-commercial license, not just no license.

  1. If you donā€™t get a prince version from that command, make sure you actually installed it, not just unpacked it. Prince has decent walkthroughs on its website. Then take care of the non commercial license.

Hope that helps. Good luck.

1 Like

@beckej Thank you very much for your help! I was able to finally get everything working. I got a fresh copy of Prince installed and working correctly, think I was using the wrong version originally.

This was definitely a learning process. Wish this was all documented better, but glad I got it working!

1 Like