Jump to content

Easiest HTML To PDF PHP Class or Script for Shared Hosting Account?


justravis

Recommended Posts

I want to be able to enter a url and have it converted to pdf. Since I have a shared hosting account without access to PDFLib or compilers to install software, my options seem limited.

 

FPDF's documentation says it will not serve this purpose.

 

DOMPDF sounds like a good fit, but...

<?php
 require_once("dompdf_config.inc.php"); //include dompdf config
 $old_limit = ini_set("memory_limit", "16M");
 $dompdf = new DOMPDF();
 //$dompdf->load_html("YOUR HTML TEXT");
 $dompdf->load_html_file('http://www.reuters.com/finance/stocks/companyProfile?rpc=66&symbol=SNE');
 $dompdf->set_paper("PAPER SIZE HERE", "ORIENTATION HERE");
 $dompdf->render();
 $dompdf->stream("dompdf_out.pdf");
 exit(0);
?>

 

returned -> http://powerontechnologies.com/_functions/php/pdf/dompdf/TEST.php

 

What do you reccomend??

 

THANKS!

Link to comment
Share on other sites

I work at Expected Behavior, and we've developed an HTML to PDF API called DocRaptor. DocRaptor uses Prince XML for PDF generation, and we use HTTP POST requests to create PDFs.

 

You can try this example:

 

http://docraptor.com/documentation/examples_php

 

However, this requires the pecl_http extension, so it may not work for you. In that case, you could try this wrapper one of our users wrote:

 

https://github.com/krewenki/php-docraptor/

 

DocRaptor is a subscription-based service, but we also have a free plan that allows users to create up to 5 documents per month at no cost. All plans have a 30 day trial, and you can create unlimited test documents.

 

I hope this helps, or at least provides an alternative for you.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.