html2pdf

How to add TTF font to html2pdf PHP program

断了今生、忘了曾经 提交于 2019-12-06 01:45:43
问题 I'm trying to use HTML2PDF 4.03 with this code: <?php $content = "..."; # my HTML code require_once(dirname(__FILE__).'/html2pdf_v4.03/html2pdf.class.php'); $html2pdf = new HTML2PDF('P','A4','en', true, 'utf-8', array(15,20,15,20) ); # here I'm trying to add my arial.ttf $html2pdf->pdf->AddTTFFont('arial.ttf'); $html2pdf->WriteHTML($content); $html2pdf->Output('exemple.pdf'); ?> Now the program die with this: PHP Fatal error: Call to undefined method HTML2PDF_myPdf::AddTTFFont() How can I add

How to get rid of the left and top margins in css when using html2pdf

冷暖自知 提交于 2019-12-04 11:17:33
I'm using html2pdf and I want to get rid of the top and left margins using css but I can't. Before output buffering margin is already set to 0, it works on html but when I convert it to pdf using html2pdf the top and left margins appears again. Here's my current css. body { margin: 0; padding: 0; } #box { margin: 0; padding: 0; width: 803px; height: 1400px; border: 1px solid #000; } Please help. I suspect that the margins are generated by html2pdf, not from the html/css. Have you tried to set the margins in the html2pdf-constructor ? E.g. with array(0, 0, 0, 0) as last parameter: $html2pdf =

Html2pdf doesn't support word-break:break-all css

南笙酒味 提交于 2019-12-04 05:06:34
hai everybody i am using html2pdf ,it doesn't support word-break:break-all css any idea? example <td style="width:30%;word-break:break-all ;"> testtestetstetstetstetstettstetstetstetstetstetstetstetstetstetstets </td> output pdf take above 30% width like string length size output pdf: testtestetstetstetstetstettstetstetstetstetstetstetstetstetstetstets I want Output : testtestetstetstetstetstettstets tetstetstetstetstetstetstetstets Well, that's complicated. Your teststring is too long, but it's not composed of multiple words. That means that word-break won't work, because there aren't any

Execute wkhtmltopdf from PHP

余生颓废 提交于 2019-12-04 01:52:12
I have this working fine from Linux command line: wkhtmltopdf entry.html output.pdf But the following doesn't work from PHP code: exec ('wkhtmltopdf entry.html output.pdf'); Interesting, I've googled and a lot of non-checked solutions and with no explanation why this is a problem. Thanks if you have the good ones. wkhtmltopdf has bindings , one of them is for PHP. You could give those a shot. Andrei Sandulescu had the same problem and i don't think anyone else should waste > 3 hours: the solution is here: wkhtmltopdf error in apache log you just have to install xvfp "to emulate a x-environment

Working with css floats in html2pdf

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 10:45:42
I'm using floats to position 2 divs beside each other. <a href="printbox.php">print</a> <?php ob_start(); ?> <style> #sidedish{ float: left; border: 1px solid black; width: 100px; height: 100px; } #maindish{ float: right; width: 200px; border: 1px solid black; height: 100px; text-align: center; } #container{ width: 304px; height: 100px; border: 1px solid black; } </style> <div id="container"> <div id="sidedish"></div> <div id="maindish"><div id="box">name</div></div> </div> <?php $_SESSION['boxes'] = ob_get_contents(); ?> Here is what printbox do, it just renders the buffered data into a pdf,

Create new PDF from template with PHP

孤街醉人 提交于 2019-12-03 05:49:38
问题 I have a docx document file set up with formating and layout, which I saved as a PDF file. I want to use this pdf file as a template for creating new pdf files pre-filled with user data. I have seen FPDF, FPDI, tcPDF, domPDF, Zend PDF, http://koivi.com/fill-pdf-form-fields/ (Justin Koivisto), a few convertion tools like HTML2PDF and a few command line tools mentioned here on stackoverflow. With the exception of FPDI, none of them offer an example using a PDF template to either search-and

Converting html to pdf in php?

给你一囗甜甜゛ 提交于 2019-12-01 05:18:10
I know that there is a lot of posts about this problem.But can someone help me to setup this http://www.rustyparts.com/pdf.php script to work on my localhost.I just spent all week on this problem.I have download imagemagic,ghostscript,activeperl,...,everything,but still can't make simple example to work. marcog Use wkhtmltopdf via a system call. See How to install wkhtmltopdf on a linux based (shared hosting) web server for installation help. wkhtmltopdf is a command line program which permits to create a pdf from an url, a local html file or stdin. It produces a pdf like rendred with the

Converting html to pdf in php?

一世执手 提交于 2019-12-01 02:46:50
问题 I know that there is a lot of posts about this problem.But can someone help me to setup this http://www.rustyparts.com/pdf.php script to work on my localhost.I just spent all week on this problem.I have download imagemagic,ghostscript,activeperl,...,everything,but still can't make simple example to work. 回答1: Use wkhtmltopdf via a system call. See How to install wkhtmltopdf on a linux based (shared hosting) web server for installation help. wkhtmltopdf is a command line program which permits

.NET server based PDF generation

久未见 提交于 2019-11-30 07:13:16
I'd like to dynamically generate content and then render to a PDF file. This processing would take place on a remote hosting server so using virtual printers etc is out. Does any have a recommendation for a .NET library (pref C#) that would work? I know that I could generate a bunch of PS code and package it myself but I'd prefer something a little less tricksy at this stage. Thanks! I have had good success using SharpPDF . Have a look at http://itextsharp.sourceforge.net/ . Its open source. Tutorial: http://itextdocs.lowagie.com/tutorial/ quimbo I have had success using Siberix http://www

Converting HTML in PHP File to PDF File [closed]

和自甴很熟 提交于 2019-11-29 16:00:33
I have a php file which queries a database and then writes and updates the html accordingly. I have a button on this page "Export As PDF"..I am trying to convert this page to a pdf using HTML2FPDF, but I get the following error: FPDF error: Unable to create output file: Entry Report I suspect the problem is because I am passing a php file instead of a html file: <?php require('html2fpdf.php'); if(isset($_POST['link'])){ $url = $_POST['link']; $nm = $_POST['nm']; convert($url, $nm); } function convert($link, $name){ $pdf=new HTML2FPDF(); $pdf->AddPage(); $fp = fopen($link,"r"); $strContent =