createPDF returning errors on a particular Bluehost server

7 posts by 2 authors in: Forums > CMS Builder
Last Post: November 16, 2019   (RSS)

By daniel - November 14, 2019

Hi Jerry,

The ContentNotFoundError issue looks to be a bit nebulous and may be caused by issues with some assets being loaded on the page, or issues with the network request asking for the page (e.g. redirects). A few things you can try to narrow it down:

  • Try to render a PDF of "known good" HTML on the server at issue
  • Try to render a PDF using a document not on the server at issue

Both of these cases can be tested using the Example Code link that comes with the plugin. If you can render PDFs of other documents on the server then you'll have to figure out what part of the original PDF is causing an error. If you can render PDFs of documents on other servers but none on your own, this points to a server configuration issue - check for things like redirects or htaccess rules that may be interfering with the request.

For the other error - Permission denied - unless you feel comfortable making file permission adjustments through the command line I would recommend raising this one with your hosting support. If this was previously working then they may know if there was any recent server changes that could have had an impact, and/or otherwise be able to help correct the permission issue.

Hope the above is helpful - let me know if you have any more questions!

Thanks,
Daniel

Daniel
Technical Lead
interactivetools.com

By gkornbluth - November 14, 2019

Daniel,

Thanks for the insights.

I'll look at it in the morning.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - November 15, 2019 - edited: November 15, 2019

Hi Daniel,

I've made a little progress so far, but I really don't understand what's going on with permissions.

After a lot of trial and error it seems that after I removed a link to a missing .css file from the head of the file on the site that threw the "Exit with code 1 due to network error: ContentNotFoundError Error executing wkhtmltopdf! (Exit code: 1)<br/>" error, the file generates PDFs as it should.

Seems Pretty Picky....

As far as changing permissions on the command line, I don't think I can do this on a shared server at Bluehost.

Anything more specific that I can tell them that won't trigger their classic "But it's not a Wordpress site and we can't help with custom coded sites" response?

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By daniel - November 15, 2019

Hey Jerry,

Glad you figured out one of the issues - that is a fairly nitpicky reason to throw an error, but good to know for the future!

Anything more specific that I can tell them that won't trigger their classic "But it's not a Wordpress site and we can't help with custom coded sites" response?

This is a bit trickier, as I don't have any direct experience with Bluehost or what their support considers "in scope." The specific thing you want them to help with is updating the permissions on a file so that it can be executed by a PHP script using the "exec()" function. This line of the error shows specifically where the file is:

sh: /home2/ngpymrmy/public_html/thecmsbcookbook/cmsAdmin/plugins/createPDF1.09/wkhtmltopdf/wkhtmltopdf-0.12.5-1.centos6.x86_64: Permission denied

If this was previously working (and you haven't made any changes to the plugin) then I'd also suggest bringing that up, as it puts the onus on the host to figure out why something that was working on their system no longer is.

If that doesn't lead anywhere, a local permission issue shouldn't stop you from using a different working host as a proxy - if you have one available.

Good luck!

Daniel
Technical Lead
interactivetools.com

By gkornbluth - November 15, 2019 - edited: November 15, 2019

Thanks Daniel,

I'm assuming that this is a different thing then standard read write execute file permission like 0755 or 0644.

Seems that almost any issue is 'out of scope' for them lately. I'll give them a try, but also try the proxy route.

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - November 16, 2019

Most of the issues with the createPDF plugin are now resolved, and for anyone else who is finding issues here's what I've discovered so far:

Note that All my PDF Conversions were working before some unknown server changes were made on a particular shared server at Bluehost.

1) Normally, on a list viewer I'd have the code <?php if (@$_REQUEST['pdf']) { createPDF_fromOutput('inline', 'example.pdf'); } ?> at the top of my page after the get records code block.

Then I'd use a link like <a class="your_css_class" href="?pdf=1">CLICK TO CONVERT THIS PAGE TO A PDF</a> to initiate the conversion.

I found that if I was trying to convert an index.php page to a PDF, I'd have to add index.php to the link above, or I'd get 'content not found' errors:

<a class="your_css_class" href="index.php?pdf=1">CLICK TO CONVERT THIS PAGE TO A PDF</a>
2) If any of the links in my page's head section were broken, I'd also get a 'content not found' error.

You can find all the tricks I've learned about implementing the createPDF plugin in my CMSB Cookbook at http://www.thecmsbcookbook.com/recipedetail.php?339

If anyone has any other discoveries or tricks, post them here and I'll add them to the Cookbook

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php