*Solved* Prince PDF Export Errors

I’ve successfully been able to export to ePub, but I’m in need of help getting the PDF exports to work. I have been scouring this (and other) forums to troubleshoot my problems with Prince for longer than I’d like to admit, and I’m sure it’s something simple that’s been staring me in the face. I’m hoping a new set of eyes will be able to point me in the right direction?

I have been able to generate a PDF of the ebook with Prince via Linux, BUT the book includes one image, which isn’t showing up in the Prince/Linux output (But the alt-text does, so yay?)

I have a php.ini with:

upload_max_size = 2000M
post_max_size = 2000M
max_execution_size = 1500
max_input_time = 1800

(ridiculous, right?)

I’ve updated /pressbooks/inc/modules/export/class-export to:

Maximum execution time, in seconds. If set to zero, no time limit
@set_time_limit( apply_filters( 'pb_set_time_limit', 0, 'export' ) ); 


Pressbooks Diagnostics:

WordPress Configuration

Network Type: Subdirectory
Version: 5.2.2
Language: en_US
WP_ENV: Not set
WP_DEBUG: Enabled
Memory Limit: 64M

Pressbooks Configuration

Version: 5.8.2
Book Theme: McLuhan
Book Theme Version: 2.8.7
Root Theme: Aldine
Root Theme Version: 1.6.4

Pressbooks Dependencies

Epubcheck: Not Installed
Kindlegen: Not Installed
xmllint: Installed
PrinceXML: Installed
Saxon-HE: Not Installed

Must-Use Plugins

hm-autoloader.php: n/a

Network Active Plugins

Pressbooks: 5.8.2

Book Active Plugins

Pressbooks: 5.8.2

Inactive Plugins

Akismet Anti-Spam: 4.1.2
Hello Dolly: 1.7.2
mPDF for Pressbooks: 3.1.0

Server Configuration

PHP Version: 7.2.19
MySQL Version: 5.5.60
Webserver Info: Apache/2.4.6 (CentOS) PHP/7.2.19

PHP Configuration

Safe Mode: Disabled
Memory Limit: 512M
Upload Max Size: 2000M
Post Max Size: 2000M
Upload Max Filesize: 2000M
Time Limit: 300
Max Input Vars: 1000
URL-aware fopen: On (1)
Display Errors: N/A

PHP Extensions

OPcache: Disabled
XDebug: Disabled
cURL: Supported
cURL Version: 7.29.0
imagick: Not Installed
xsl: Installed

And then finally, the output from the error log:

[01-Aug-2019 20:17:47 UTC] Pressbooks\Modules\Export\Prince\Pdf
[time] => Thu Aug 1 20:17:47 2019
[warning] => 1
Thu Aug 1 20:17:17 2019: ---- begin
Thu Aug 1 20:17:47 2019: http://. . ./format/xhtml?timestamp=1564690634&hashkey=a53f2de4f4b2af1707d0afecc29e9c0a: error: Connection timed out after 30001 milliseconds
Thu Aug 1 20:17:47 2019: http://. . ./format/xhtml?timestamp=1564690634&hashkey=a53f2de4f4b2af1707d0afecc29e9c0a: error: could not load input file
Thu Aug 1 20:17:47 2019: error: failed to load all input documents
Thu Aug 1 20:17:47 2019: finished: failure
Thu Aug 1 20:17:47 2019: ---- end

Any guidance will be very appreciated!
Thank you!


  • I’ve removed the lines noted above from the php.ini file.
  • I edited the class-pdf.php file to timeout after 2400 seconds

Now my error message has changed to:

Wed Aug 7 20:38:05 2019: ---- begin
Wed Aug 7 20:40:12 2019: http:// . . . . /format/xhtml?timestamp=1565210282&hashkey=c1d44b257958c96d33f238c3e51ed987: error: Failed to connect to [URL] port 80: Connection timed out
Wed Aug 7 20:40:12 2019: http:// . . . . /format/xhtml?timestamp=1565210282&hashkey=c1d44b257958c96d33f238c3e51ed987: error: could not load input file
Wed Aug 7 20:40:12 2019: error: failed to load all input documents
Wed Aug 7 20:40:12 2019: finished: failure
Wed Aug 7 20:40:12 2019: ---- end

So now I’m looking at a port 80 problem. httpd is currently running on said port, I’m 95% certain I have permissions set correctly on everything, I’ve made sure I don’t have a firewall running, and I’ve tried running it without SELinux.
Any thoughts or suggestions?

This looks similar to this past issue on the forums:

@jgray how did you fix your problem? Any advice?

Hi @beckej, I don’t think we fixed the issue, but I unfortunately can’t find my emails related to this issue to verify (we recently switched email providers).

@beckej and @jgray Thank you very much for your help!

It turns out this wasn’t a problem with my Pressbooks configuration (which the port 80 error should have tipped me off to sooner than it did, but hey, I got there…)

Rather, the problem was with my cURL settings.
I ran curl mydomain.com, and I got the curl 7 error. All I needed to do was nano /etc/hosts and have the ip point towards mydomain.com.

1 Like