# Troubleshooting PrinceXML

**URL:** <https://pressbooks.community/t/troubleshooting-princexml/445>\
**Category:** Troubleshooting Installation/Upgrades\
**Created:** [March 22, 2018, 12:35pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445 "2018-03-22T12:35:35Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![beckej](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/e19b73/32.png) [@beckej](https://pressbooks.community/u/beckej)\
**Post date:** [March 22, 2018, 12:35pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/1 "2018-03-22T12:35:35Z")

</div>

I am having the hardest time getting PrinceXML to work. I have it installed on my Ubuntu server. Using the command line I can convert documents using a command like this:

/usr/bin/prince home/ubuntu/Writing-in-College.html -o home/ubuntu/writing-in-college.pdf

So I know my path to prince is ‘/usr/bin/prince’ and I know it works.

So in my wp-config.php I have added the lines:

/\* Converters \*/  
define( ‘PB\_PRINCE\_COMMAND’, ‘/usr/bin/prince’);  
define( ‘PB\_XMLLINT\_COMMAND’, ‘/usr/bin/java -jar /usr/bin/xmllint’);  
define( ‘PB\_EPUBCHECK\_COMMAND’, ‘/usr/bin/java -jar /usr/bin/epubcheck/epubcheck.jar’);  
define( ‘PB\_KINDLEGEN\_COMMAND’, ‘/usr/bin/kindlegen/kindlegen’);

But pressbooks is still telling me that I don’t have prince installed. What should I try next?

I do not have a license, but I am just doing this for non-commercial purposes, so I was ok with having a watermark on the first page.

[http://www.princexml.com/howcome/2014/faq/#non-commercial](http://www.princexml.com/howcome/2014/faq/#non-commercial)

Are there any PHP packages or dependencies that I might need to install?

### System Information

#### Root Blog Info

Root Blog ID: 1  
Root Blog URL: [http://oer.ed-beck.com/](http://oer.ed-beck.com/)

#### Browser

Platform: OS X  
Browser Name: Chrome  
Browser Version: 65.0.3325.162  
User Agent String: Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_13\_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36

#### WordPress Configuration

Network URL: [http://oer.ed-beck.com/](http://oer.ed-beck.com/)  
Network Type: Subdirectory  
Version: 4.9.4  
Language: en\_US  
WP\_ENV: production  
WP\_DEBUG: Enabled  
Memory Limit: 64M

#### Pressbooks Configuration

Version: 5.1.0  
Root Theme: Aldine  
Root Theme Version: 1.1.0

#### Pressbooks Dependencies

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

#### Must-Use Plugins

hm-autoloader.php: n/a

#### Network Active Plugins

Candela LTI: 0.1  
Candela Thin Exports: 0.1  
GitHub Updater: 7.5.0  
H5P: 1.10.1  
Hypothesis: 0.5.0  
LTI: 0.1  
Pressbooks: 5.1.0  
Textbooks for Pressbooks: 4.0.2

#### Root Blog Active Plugins

#### Inactive Plugins

Akismet Anti-Spam: 4.0.3  
CC Export for Pressbooks: 0.2.1  
Docraptor for Pressbooks: 2.2.1  
Hello Dolly: 1.6  
mPDF for Pressbooks: 3.1.1  
Wp Show Site ID: 1.0.0

#### Server Configuration

PHP Version: 7.0.28-0ubuntu0.16.04.1  
MySQL Version: 5.7.21  
Webserver Info: Apache/2.4.18 (Ubuntu)

#### PHP Configuration

Safe Mode: Disabled  
Memory Limit: 500M  
Upload Max Size: 2000M  
Post Max Size: 2000M  
Upload Max Filesize: 2000M  
Time Limit: 30  
Max Input Vars: 1000  
URL-aware fopen: On (1)  
Display Errors: On (1)

#### PHP Extensions

OPcache: Zend  
XDebug: Disabled  
cURL: Supported  
cURL Version: 7.47.0  
imagick: Installed  
xsl: Installed

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [March 22, 2018, 1:11pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/2 "2018-03-22T13:11:38Z")

</div>

Hi @beckej, what is the output of `/usr/bin/prince --version`?

---

<div class="post-metadata">

**Author:** ![beckej](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/e19b73/32.png) [@beckej](https://pressbooks.community/u/beckej)\
**Post date:** [March 22, 2018, 2:19pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/3 "2018-03-22T14:19:08Z")

</div>

/$ usr/bin/prince --version  
prince: /usr/lib/prince/license/license.dat: error: can’t open input file: No such file or directory  
prince: warning: failed to load external entity “/usr/lib/prince/license/license.dat”  
prince: /usr/lib/prince/license/license.dat: warning: could not load license  
Prince 20171214  
Copyright 2002-2017 YesLogic Pty. Ltd.  
No license

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [March 22, 2018, 2:29pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/4 "2018-03-22T14:29:00Z")

</div>

Ah, so that’s the issue. You should have a non-commercial license file installed. Did you use our Ansible role? It lets you specify a local path to a license file:

> **[pressbooks/ansible-role-princexml](https://github.com/pressbooks/ansible-role-princexml#role-variables)**
>
> Ansible Role which installs PrinceXML. Contribute to pressbooks/ansible-role-princexml development by creating an account on GitHub.

You can download a `.tar.gz` file from Prince, e.g. [https://www.princexml.com/download/prince-11.3-ubuntu16.04-amd64.tar.gz](https://www.princexml.com/download/prince-11.3-ubuntu16.04-amd64.tar.gz), and use the `license.dat` file from there:

![09 AM](https://pressbooks.community/uploads/default/original/1X/f5cc68a30493e5bc931a8c5ad83cc08b155825d0.png)

But, the default license file should be installed… not sure why it isn’t in your case. Can you run `ls -al /usr/lib/prince` and share the output? Should have something like the following:

```auto
total 0
drwxr-xr-x 12 ubuntu admin 384 10 Jul 2017 .
drwxr-xr-x 446 ubuntu admin 14272 25 Dec 14:09 ..
drwxr-xr-x 3 ubuntu admin 96 10 Jul 2017 bin
drwxr-xr-x 3 ubuntu admin 96 10 Jul 2017 dict
drwxr-xr-x 13 ubuntu admin 416 10 Jul 2017 dtd
drwxr-xr-x 3 ubuntu admin 96 10 Jul 2017 etc
drwxr-xr-x 58 ubuntu admin 1856 10 Jul 2017 hyph
drwxr-xr-x 6 ubuntu admin 192 10 Jul 2017 icc
drwxr-xr-x 4 ubuntu admin 128 10 Jul 2017 lib
drwxr-xr-x 3 ubuntu admin 96 20 Jul 2015 license
drwxr-xr-x 4 ubuntu admin 128 10 Jul 2017 math
drwxr-xr-x 11 ubuntu admin 352 10 Jul 2017 style

```

---

<div class="post-metadata">

**Author:** ![beckej](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/e19b73/32.png) [@beckej](https://pressbooks.community/u/beckej)\
**Post date:** [March 22, 2018, 3:40pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/5 "2018-03-22T15:40:28Z")

</div>

I’m not familiar enough with ansible to make the ansible role work without a tutorial of some kind. I did try, and that’s when I submitted that bug to git yesterday.

I installed prince by installing aptitude and then using the gdebi commands. It’s interesting that the PDF outputs worked from the command line but not from Pressbooks.

Now when I run the same command I get:

$ usr/bin/prince --version  
Prince 20171214  
Copyright 2002-2017 YesLogic Pty. Ltd.  
Non-commercial License

In desperation I have opened the permissions wide open here, trying to see if that was the problem. I know this is not responsible management.

$ ls -al  
total 48  
drwxrwxrwx 12 www-data www-data 4096 Mar 21 18:41 .  
drwxr-xr-x 78 root root 4096 Mar 21 18:41 …  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 bin  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 dict  
drwxrwxrwx 12 www-data www-data 4096 Mar 21 18:41 dtd  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 etc  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 hyph  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 icc  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 lib  
drwxrwxrwx 2 www-data www-data 4096 Mar 22 15:30 license  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 math  
drwxrwxrwx 2 www-data www-data 4096 Mar 21 18:41 style

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [March 22, 2018, 3:51pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/6 "2018-03-22T15:51:09Z")

</div>

@beckej Those permissions should be restored to the way they were before. Did you do anything prior to running the `--version` command again? The first message indicated that Prince could not find the license, the second indicated that it could, so I assume you copied the file there?

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [March 22, 2018, 3:52pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/7 "2018-03-22T15:52:35Z")

</div>

> [@beckej](#):
>
> It’s interesting that the PDF outputs worked from the command line but not from Pressbooks.

The reason for this is that we check to see if a specific version of Prince is installed (11.x or greater) because we need that version for specific Prince features. The `/usr/bin/prince --version` command was not returning the version so we couldn’t detect the installation properly.

---

<div class="post-metadata">

**Author:** ![beckej](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/e19b73/32.png) [@beckej](https://pressbooks.community/u/beckej)\
**Post date:** [March 22, 2018, 3:54pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/8 "2018-03-22T15:54:11Z")

</div>

yes I did put the license there. I will restore the owner of those files, and redo the permissions exactly like your screenshot. At this point Pressbooks is still not detecting that the program is installed and report back.

I really appreciate your help.

---

<div class="post-metadata">

**Author:** ![beckej](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/e19b73/32.png) [@beckej](https://pressbooks.community/u/beckej)\
**Post date:** [March 22, 2018, 4:04pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/9 "2018-03-22T16:04:21Z")

</div>

Corrected settings, Pressbooks still not detecting… What next?

ls -al  
total 48  
drwxr-xr-x 12 ubuntu admin 4096 Mar 21 18:41 .  
drwxr-xr-x 78 root root 4096 Mar 21 18:41 …  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 bin  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 dict  
drwxr-xr-x 12 ubuntu admin 4096 Mar 21 18:41 dtd  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 etc  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 hyph  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 icc  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 lib  
drwxr-xr-x 2 ubuntu admin 4096 Mar 22 15:30 license  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 math  
drwxr-xr-x 2 ubuntu admin 4096 Mar 21 18:41 style

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [March 22, 2018, 4:07pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/10 "2018-03-22T16:07:05Z")

</div>

Are you seeing that Prince is not installed on the Diagnostics page?

---

<div class="post-metadata">

**Author:** ![dac.chartrand](https://pressbooks.community/user_avatar/pressbooks.community/dac.chartrand/32/152_2.png) [@dac.chartrand](https://pressbooks.community/u/dac.chartrand)\
**Post date:** [March 22, 2018, 4:36pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/11 "2018-03-22T16:36:26Z")

</div>

`exec` config:

- When safe mode is enabled, you can only execute files within the safe\_mode\_exec\_dir.
- For practical reasons, it is currently not allowed to have … components in the path to the executable.

In a text editor, open this file and navigate to this function:

> <https://github.com/pressbooks/pressbooks/blob/31e6fb85f302f09fdf2b956d32f9feec243ec4a0/inc/utility/namespace.php#L340>

Change to:

```php
function check_prince_install() {
	if ( ! defined( 'PB_PRINCE_COMMAND' ) ) { // @see wp-config.php
		define( 'PB_PRINCE_COMMAND', '/usr/bin/prince' );
	}

	$output = [];
	$return_val = 0;
	exec( PB_PRINCE_COMMAND . ' --version 2>&1', $output, $return_val );

	print_r( $output ); // TODO: Remove this line after the tech support is done

	$output = $output[0];
	if ( false !== strpos( $output, 'Prince' ) ) { // Command found.
		$output = explode( 'Prince ', $output );
		$version = $output[1];
		print_r( "COMMAND WAS FOUND AND WE THINK IT IS VERSION $version \n\n" ); // TODO: Remove this line after the tech support is done
		if ( version_compare( $version, '11' ) >= 0 ) {
			return true;
		}
	}

	return false;
}

```

Go to the diagnostics page. At the top you will see something like:

 ![image](https://pressbooks.community/uploads/default/original/1X/40b84f56a5155ba5a3f96c080cea9ca750004340.png)

If you don’t see the same thing please see reasons at start of reply?

---

<div class="post-metadata">

**Author:** ![dac.chartrand](https://pressbooks.community/user_avatar/pressbooks.community/dac.chartrand/32/152_2.png) [@dac.chartrand](https://pressbooks.community/u/dac.chartrand)\
**Post date:** [March 22, 2018, 4:41pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/12 "2018-03-22T16:41:05Z")

</div>

> [@beckej](#):
>
> Pressbooks Dependencies  
> Epubcheck: Installed  
> Kindlegen: Installed  
> **_xmllint: Not Installed_**  
> PrinceXML: Not Installed  
> Saxon-HE: Not Installed

Can you please install xmllint? Required to test XHTML outputs used by prince.

---

<div class="post-metadata">

**Author:** ![beckej](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/e19b73/32.png) [@beckej](https://pressbooks.community/u/beckej)\
**Post date:** [March 22, 2018, 5:13pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/13 "2018-03-22T17:13:51Z")

</div>

Victory!

So my path to xmllint was wrong, because I had java in there like EPUBCHECK.

So the real problem was never with prince, it was with xmllint.

I wasn’t aware from the documentation that it was a dependency, especially since I had been able to get DocRaptor working previously, and I figured that DocRaptor and Prince would have the same requirements when it came to source information.

Thank everyone so much. I know lots of communities that wouldn’t have taken the time to walk me through this.

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [March 23, 2018, 10:37pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/14 "2018-03-23T22:37:44Z")

</div>

Glad we could help out!

---

<div class="post-metadata">

**Author:** ![BrzI](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/76d3ee/32.png) [@BrzI](https://pressbooks.community/u/BrzI)\
**Post date:** [May 25, 2018, 10:57pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/15 "2018-05-25T22:57:34Z")

</div>

Can you please tell me how you installed xmllint ?

Thanks

---

<div class="post-metadata">

**Author:** ![beckej](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/e19b73/32.png) [@beckej](https://pressbooks.community/u/beckej)\
**Post date:** [May 26, 2018, 1:09am UTC](https://pressbooks.community/t/troubleshooting-princexml/445/16 "2018-05-26T01:09:31Z")

</div>

Did you try something like:

Sudo apt-get install libxml2-utils

Then you would have to determine the exact path to xmllint and get that into your config file.

---

<div class="post-metadata">

**Author:** ![BrzI](https://pressbooks.community/letter_avatar_proxy/v4/letter/b/76d3ee/32.png) [@BrzI](https://pressbooks.community/u/BrzI)\
**Post date:** [May 28, 2018, 4:50pm UTC](https://pressbooks.community/t/troubleshooting-princexml/445/17 "2018-05-28T16:50:19Z")

</div>

Yes - I did and it worked. Thanks anyway.
