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!

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.