tcpdf

Why is there a left and top padding in a cell using TCPDF in php?

谁说我不能喝 提交于 2019-11-30 02:43:30
问题 I am printing a cell using the TCPDF(http://www.tcdf.org/) class in php. The cell should be placed into the top left corner. Everything works great, except that a left and top padding is added inside the cell. Here is my code: require_once('../config/lang/eng.php'); require_once('../tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetMargins(0,0,0); $pdf->SetAutoPageBreak(0,0); $pdf->SetFont('dejavusans', '', 8.5, '', true); $pdf-

Manual Page Break in TCPDF

ぃ、小莉子 提交于 2019-11-29 23:40:49
I am using TCPDF to generate the PDF in one of my projects. I simply create a HTML file and give it to the TCPDF to handle the PDF generation. But now I have some HTML where multiple certificates are added one after the other and I want to have a page break in it. Page Break should be decided by HTML i.e. I want to know if there is any identifier in HTML which TCPDF understands and then accordingly adds a page break into the generated PDF. How could I do this? AmdY I'm using <br pagebreak="true"/> . Find method writeHTML and code if ($dom[$key]['tag'] AND isset($dom[$key]['attribute'][

How to create PDF documents from image files, using PHP

有些话、适合烂在心里 提交于 2019-11-29 19:02:24
问题 With PHP application, I have to generate single PDF documents, from set of images. Which is best way to achieve this? Can I use TCPDF library, and can you give me some example? 回答1: The easiest way is to use TCPDF (http://www.tcpdf.org) and set the images as full background as on the example n. 51. For example: // disable auto-page-break $pdf->SetAutoPageBreak(false, 0); // set image 1 $pdf->AddPage(); $this->Image('image_demo1.jpg', 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0

PHP TCPDF remove header's bottom border

久未见 提交于 2019-11-29 16:08:07
问题 I am trying to create a header in TCPDF, however it always have a border underneath of it. Is there a way I can remove the bottom border? 回答1: tcpdf.php: // print an ending header line $this->SetLineStyle(array('width' => 0.25 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 255))); 回答2: This works for some versions: // Call before the addPage() method $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); 回答3: If you don't want to subclass or change

TCPDF - printing table from mysql

折月煮酒 提交于 2019-11-29 14:46:30
问题 in my php, while($info3 = mysql_fetch_array($result3)){ $Name = $info3["Name"]; $Address = $info3["Address"]; $Age = $info3["Age"]; // ----------------------------------------------------------------------------- $tbl = ' <table style="width: 638px;" cellspacing="0"> <tr> <td style="border: 1px solid #000000; width: 150px;">'.$Name.'</td> <td style="border: 1px solid #000000; width: 378px;">'.$Age.'</td> <td style="border: 1px solid #000000; width: 110px; text-align:center">'.$Address.'</td>

TCPDF image quality issues

↘锁芯ラ 提交于 2019-11-29 14:12:38
问题 I'm using a TCPDF to generate PDF documents and I'm trying to add a logo into header, but I have a problem with the image quality and later as I found out, with scaling also. The images inserted into PDF documents with TCPDF suffer from quality losses and size issues. I don't care so much for the size because I can change it, but I can't restore the quality of image. What I have tried: TCPDF scaling and quality issue tcpdf: poor image quality I have also converted header into HTML code, same

Why is TCPDF Image smaller than it should be?

左心房为你撑大大i 提交于 2019-11-29 11:53:34
问题 I have a 842 x 595 PDF, 72 dpi and i'm inserting a 1200x800 image, again with 72dpi. scaleFactor is 1, imageScale is 1 in theory, my pdf should show part of the image (the first 842px). In reality the ratio is wrong, i have white space to the right and bottom. I'm upgrading from FPDF and if i switch back to that it shows the picture ok. $pdf = new TCPDF($this->orientation, 'pt', $this->format, true, 'UTF-8', false); $pdf->setMargins(0, 0, -1, 1); $pdf->setJPEGQuality(90); $pdf->setImageScale

How to center html table?

江枫思渺然 提交于 2019-11-29 11:43:15
Trying to create proper PDF document, using PHP and TCPDF. Can you help me, how can I use writeHTML function to create and center table, in TCPDF? Tryed with: $html = ' <div style="margin-left: auto; margin-right: auto; width: 50%"> <table border="1" width="200" align="center"><tr><td><b>Invoice number: '.$this->xInvoiceNumber.'</b></td></tr></table> <br /> <table border="1" width="200" align="center"><tr><td>'.$this->xClient.'</td></tr></table> <br /> </div> ... but no luck. RAfAR You have to make a table with 3 columns, set the width for every one of them and in the middle one you have to

HTML Rendering with TCPDF(PHP)

自作多情 提交于 2019-11-29 08:09:33
I am using TCPDF's writeHtml function for a page that renders properly in the browser. In the output PDF, the fonts are too small. I've tried with setFont, but it doesn't seem to have an effect. Does anyone have experience with this? I'd like to add here that the HTML is not always in my control, so I would prefer to do this with TCPDF options(and not by modifying the source html) UPDATE : I am able to change the font size by setting it on the body. The only remaining problem is that, to render correctly in the browser, it needs to be 12px. To render correctly in the PDF, it needs be something