This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Wordpress

owenhoskins wrote on 2012-10-31:
Hello,

I've been testing your service as a solution to saving pages (or parts of pages, ideally) of a Wordpress site. However, I am having issues with how to integrate the API examples.

I'd like to take this example:

$pdf_from_html = $client->convertHtml('<b>bold</b> and <i>italic</i>');

where I will be using a $var stored with HTML from $var = ob_get_contents(), inorder to save only part of the page as a PDF.

Unfortunately, I can't work out how to go then set it up so that a link will generate a PDF with that content.

Any pointers in the right direction would be greatly appreciated!

best,
Owen
support wrote on 2012-11-01:
Hello Owen,

one option would be to add a parameter to the link URL, for example
<a href="http://yourdomain.com/mypage.php?pdf=1">Save to PDF</a>

and then render your page conditionally based on the presence of the pdf parameter.

The idea with the pdf parameter added to the URL is outlined in this post, scroll down to the "Provide a PDF version of your web pages" section.
owenhoskins wrote on 2012-11-06:
Hello,

Thanks, I've set it up to render the page conditionally, however, I am having problems getting the page from the URL, at first it was generating the index.php page, because Wordpress routes everything through there, so I used $_SERVER['REQUEST_URI'] instead, which returns the correct URL. However, the PDF generates the 404 page... Do you think this is a pretty permalink issue? Not sure how to proceed.

best,
Owen