tcpdf

How do you add custom fonts in TCPDF?

眉间皱痕 提交于 2019-12-01 01:12:12
问题 I would like to add a custom font to a pdf I'm generating using TCPDF. I might be missing something but the docs seem to be out dated. They are referencing the addTTFfont() function but I think it's been deprecated and no longer exists in the latest version of TCPDF. I read that I need to convert the ttf file and put it in the fonts folder so I ran: php/tcpdf/tools/tcpdf_addfont.php -i php/font/rumpelstiltskin-webfont.ttf and it generated these files which are now in the fonts folder:

How do you make a table like this with FPDF using PHP?

白昼怎懂夜的黑 提交于 2019-11-30 19:13:28
How do you make a table like this with FPDF using PHP? I can't seem to figure out how to do this with $this->Cell . FPDF does not recognize rowspan or colspan . Here is a workaround that you can try, using empty cells and the border attribute for Cell . $pdf->Cell(40,5,' ','LTR',0,'L',0); // empty cell with left,top, and right borders $pdf->Cell(50,5,'Words Here',1,0,'L',0); $pdf->Cell(50,5,'Words Here',1,0,'L',0); $pdf->Cell(40,5,'Words Here','LR',1,'C',0); // cell with left and right borders $pdf->Cell(50,5,'[ x ] abc',1,0,'L',0); $pdf->Cell(50,5,'[ x ] checkbox1',1,0,'L',0); $pdf->Cell(40,5

PHP TCPDF remove header's bottom border

自古美人都是妖i 提交于 2019-11-30 10:54:33
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? 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))); András This works for some versions: // Call before the addPage() method $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); If you don't want to subclass or change the tcpdf source just call the setHeaderData method and specify white line color. $pdf->setHeaderData('',0,'','

tcpdf edit footer

末鹿安然 提交于 2019-11-30 09:25:06
How do I edit a footer using tcpdf? I want to add current date & time at the footer. Please help. Override the class like this : class MYPDF extends TCPDF { public function Footer() { $image_file = "img/bg_bottom_releve.jpg"; $this->Image($image_file, 11, 241, 189, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false); $this->SetY(-15); $this->SetFont('helvetica', 'N', 6); $this->Cell(0, 5, date("m/d/Y H\hi:s"), 0, false, 'C', 0, '', 0, false, 'T', 'M'); } } then instead of calling : $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); do

TCPDF image quality issues

拜拜、爱过 提交于 2019-11-30 09:18:19
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 quality degradation occurrs. Removed all other options for $pdf->Image() and left everything in default

Why is TCPDF Image smaller than it should be?

旧街凉风 提交于 2019-11-30 08:30:17
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(1); $pdf->Image($image->path,0,0,0,0,'','','T',false, 72,'',false,false,0,'LT'); The sizes and scales

TCPDF, “Could not include font definition file” with OpenType fonts

只谈情不闲聊 提交于 2019-11-30 06:48:26
问题 I am a web programmer with no in-depth knowledge of fonts and am struggling to get TCPDF to include our custom OpenType font. We have bought OpenType font files (.oft), which are not protected by any kind of DRM. A lot of questions regarding this error message end up getting the same advice. I've set the correct file permissions for the folders used by TCPDF (755) and I have no trouble using the addTTFfont() to including .ttf TrueType fonts like so: $pdf->addTTFfont('/path-to-font/DejaVuSans

TCPDF twice as slow as FPDF with same code

泪湿孤枕 提交于 2019-11-30 05:41:48
I currently use FPDF to create some fairly complicated reports and am trying to upgrade to TCPDF, but I've found that my same code running through TCPDF is about twice as slow. Because my PDFs already take up to a minute to generate I can't really afford to have this slowdown, but I'd really like to take advantage of some TCPDF features (like creating bookmarks). If anyone has some information on this problem I'd really appreciate it - either things you did to make TCPDF faster, or just confirmation that it runs slower than FPDF, so I can forget about it and just stick with FPDF. Here is a

How do you make a table like this with FPDF using PHP?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 03:51:53
问题 How do you make a table like this with FPDF using PHP? I can't seem to figure out how to do this with $this->Cell . 回答1: FPDF does not recognize rowspan or colspan . Here is a workaround that you can try, using empty cells and the border attribute for Cell. $pdf->Cell(40,5,' ','LTR',0,'L',0); // empty cell with left,top, and right borders $pdf->Cell(50,5,'Words Here',1,0,'L',0); $pdf->Cell(50,5,'Words Here',1,0,'L',0); $pdf->Cell(40,5,'Words Here','LR',1,'C',0); // cell with left and right