tcpdf

How to set the background color for every page tcpdf

懵懂的女人 提交于 2020-01-23 08:14:34
问题 I'm currently using TCPDF to generate a resume in my web application. But with the limited support for css have cornered me. Now I'm trying to apply the background color for the every page that is generated. But I'm only getting the color for the first page. My code is: <?php class PROFILE_PDF extends TCPDF { public function Header() { $this->SetFillColor(52, 21, 0, 76); $this->Rect(0, 0, $this->getPageWidth(), $this->getPageHeight(), 'DF', ""); } private $footer_data = array(); public

How to set the background color for every page tcpdf

雨燕双飞 提交于 2020-01-23 08:14:23
问题 I'm currently using TCPDF to generate a resume in my web application. But with the limited support for css have cornered me. Now I'm trying to apply the background color for the every page that is generated. But I'm only getting the color for the first page. My code is: <?php class PROFILE_PDF extends TCPDF { public function Header() { $this->SetFillColor(52, 21, 0, 76); $this->Rect(0, 0, $this->getPageWidth(), $this->getPageHeight(), 'DF', ""); } private $footer_data = array(); public

Using Chinese fonts in TCPDF and FPDI. Encoding problems

僤鯓⒐⒋嵵緔 提交于 2020-01-17 11:15:35
问题 I am writing a script that generates Chinese character worksheets (so students can generate and practice writing) The script is passed a 15 character string from a form in index.php. The string is then exploded into an array of 15 elements (each a Chinese character). The problem arises when I want to use the Write() function to populate the file with these characters, I've used the input to pick appropiate images without any problems but now it's the encoding of the fonts that gives me a hard

TCPDF Multicell valign not working

纵然是瞬间 提交于 2020-01-15 05:47:08
问题 I try to generate a PDF with TCPDF 5.9.141, but valign doesn't seem to work. It's in a CakePHP 2.0 function, but I don't think it matters. According to the documentation everything is valid in my code: Vertical alignment of text (requires $maxh = $h > 0) This feature works only when $ishtml=false and the cell must fit in a single page. $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetFont('helvetica', '', 7); $pdf-

TCPDF Image aspect ratio issue

烂漫一生 提交于 2020-01-14 03:36:09
问题 I have an issue with TCPDF Image inserting. Here's the code i'm using : $this->Image($this->data['logo'], PDF_MARGIN_LEFT, 5, 60, 20, '', '', 'M', true); I've set the resize at true, but the TCPDF library do not respect image ratio. How can I force preserving image ratio ? For information I'm using TCPDF 6.2.8 (2015-04-29). Thanks for your support, David. 回答1: Here's the solution I found : if ('' != $this->data['logo'] && is_file($this->data['logo'])) { // select only one constraint : height

Wrong page number on setPage() function: 0

依然范特西╮ 提交于 2020-01-13 11:46:10
问题 My code for tcpdf is $file_to_show_test_details = 'pdf_view_test_details.tpl'; $test_details= $smarty->fetch($file_to_show_test_details); // Set some content to print $html = <<<EOD $test_details EOD; // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'XYZ',$pdf->writeHTML($html, true, false, true, false, '')); The function writeHTML is not working, that's why the error 'Wrong page number on setPage() function: 0' appears in the browser. Could anyone please

TCPDF - printing table from mysql showing repeated first row

本秂侑毒 提交于 2020-01-13 11:24:11
问题 I am new to TCPDF. The small problem that I am facing is that all output data is displaying the same row. I mean the first record is repeated the number of times the total data(rows) exist in the database. Here is my code $tbl_header = '<style> table { border-collapse: collapse; border-spacing: 0; margin: 0 20px; } tr { padding: 3px 0; } th { background-color: #CCCCCC; border: 1px solid #DDDDDD; color: #333333; font-family: trebuchet MS; font-size: 30px; padding-bottom: 4px; padding-left: 6px

How to set bottom margin in TCPDF?

久未见 提交于 2020-01-07 03:52:12
问题 I am using TCPDF for generating pdf. I am able to set margin for left,top and right using SetMargins($left, $top, $right = -1, $keepmargins = false) but not able to set margin for the bottom of the pdf page. Can any one help me to set bottom margin in TCPDF? Any help is appreciated. 回答1: change the values of PDF_MARGIN_FOOTER, PDF_MARGIN_BOTTOM in the following code (taken from TCPDF examples): // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf-

Extra blank page with TCPDF

99封情书 提交于 2020-01-05 09:26:14
问题 I am using TCPDF to convert a page generated by php from a mysql query which has uses a div and style="page-break-after:always" for each record, these records will vary in length. When I convert them to pdf using the below code I get an extra blank page at the end? When i print one record without the style="page-break-after:always" there is no blank page? <?php error_reporting(0); //Don't show errors in the PDF ob_clean(); //Clear any previous output ob_start(); //Start new output buffer

TCPDF cache problems when using https

巧了我就是萌 提交于 2020-01-05 04:22:05
问题 We have been using TCPDF to create PDFs on the fly for a while now and everything has been working fine. However, we changed to https today using the following htaccess code: RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.berau.at/$1 [R,L] Now we are getting the following TCPDF error: TCPDF ERROR: [Image] Unable to get image: /home/.sites/64/site1783/web/pdf2/cache/img_UgqqR0 If we remove the htaccess redirect for https, everything works fine again. We've searched the TCPDF