tcpdf

Converting HTML to PDF via PHP (install font for html2pdf)

别说谁变了你拦得住时间么 提交于 2019-12-11 18:28:43
问题 I'm currently attempting to convert HTML markup (from an xml feed) into a PDF dynamically via a PHP script. From reading other answers the best free way of doing this seemed to be to use html2pdf. // HTML2PDF require_once('/public_html/html2pdf/html2pdf.class.php'); $html2pdf = new HTML2PDF('P','A4','en'); $html2pdf->WriteHTML($htmlContent); $html2pdf->Output('/public_html/wp-content/uploads/rns/html2pdf.pdf'); The problem I'm having is my $htmlContent contains the css: FONT-FAMILY: "Times

Creating PDF using TCPDF and a specific div as the content

前提是你 提交于 2019-12-11 17:51:28
问题 I am trying to create a receipt for a web application by turning the receipt from the HTML code into a PDF so that it can be downloaded upon completion of the application. I have tried to send the code to a PHP file by assigning the contents of the targeted div to a hidden input field within a form. Upon pressing the button at the end, the js function below is executed onclick, as well as the PHP file: function print() { var elem = document.getElementById("receipt").innerHTML; document

TCPDF - adding a background to a table cell or div that shows on PDF

丶灬走出姿态 提交于 2019-12-11 11:09:44
问题 I am using TCPDF to create PDF files on the fly on my website. This is all working well, and so I would be reluctant to change and use something else now. But my problem I have just now is that I need to include an image in the PDF file, which will be of unknown size, dimensions, aspect ratio, etc. My solution for adding this was going to be to add it as a background to a table cell or to a div, and use the 'cover' property to add the image. This works fine in HTML and looks the way I want it

How can I make a custom dynamic footer in TCPDF with data taken from a database?

元气小坏坏 提交于 2019-12-11 08:38:03
问题 I would like to make a dynamic footer containing data taken from a database. How to extend TCPDF class to put those data in? // my DB stuff here $datafromdb = getDataFromDB(); class MYPDF extends TCPDF { // Page footer public function Footer() { // Position at 10 mm from bottom $this->SetY(-10); // Set font $this->SetFont('dejavusans', 'I', 8); $foot = $datafromdb.'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(); $this->MultiCell(0, 10, $foot, 0, 'C'); } } 回答1: you can add a _

Allow contents to be copied of pdf created using tcpdf

我只是一个虾纸丫 提交于 2019-12-11 08:35:42
问题 I'm creating pdf file using tcpdf. The PDF is created, but its contents are not allowed to copy. Problem: What should I do,so I will be able to copy the contents of pdf created. Is this achievable? Please guide me for the same. Thanks! Code: require_once('tcpdf_include.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetProtection($permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high

Error signing pdf with PHP's openssl_pkcs7_sign

大城市里の小女人 提交于 2019-12-11 08:32:16
问题 I am using TCPDF to generate a pdf document and sign it. TCPDF itself just calls PHP's openssl_pkcs7_sign function, which seems to me to be calling C's PKCS7_sign function based on source code. Until recently things were working fine. Then I changed certificate provider. I just updated the private key, the certificate, and the certificate chain : $pdf->setSignature( $this->public_certificate_path, $this->private_key_path, $this->private_key_password, $this->extra_certificates_path, 1); I

Set the background color in TCPDF

蹲街弑〆低调 提交于 2019-12-11 08:04:38
问题 I have set the background color for the first page manually like this: $pdf->AddPage(); $pdf->SetFillColor(52, 21, 0, 76); $pdf->Rect(0, 0, $pdf->getPageWidth(), $pdf->getPageHeight(), 'DF', ""); I'm trying to set the background color inside a for-each loop in case the elements jump on to the next page using this. if (!empty($extra_curricular_data)) { foreach ($extra_curricular_data as $data) { $extra_curricular_details .= <<<EOD <p style="font-family: courier; color: #F5F5F5;"><strong> {

TCPDF very slow generation of dynamic arabic PDF

别说谁变了你拦得住时间么 提交于 2019-12-11 06:42:35
问题 I've been using a combination of nusoap & TCPDF to ping a web service and dynamically fill out a PDF with content. The PDF itself (in english) takes around 8-9 seconds to complete for about 36 pages, some of which include bar charts. I'd also like to note that due to the format that the data is received in, I am using "writeHTML" to present it on the PDF. My major issue came around when I started trying to generate the same PDFs with arabic translations. I'm using the "Almohanad" font as

create a pdf with tcpdf in magento

狂风中的少年 提交于 2019-12-11 05:43:11
问题 I'm trying to create a pdf with TCPDF in magento, i need to import a image or a pdf and modify it. my code in firefox works good but doesn't work in chrome or in internet. i put a little of my code: my controller: public function printAction() { if (($cardCode = $this->getRequest()->getParam('code'))) { $this->loadLayout('print'); $this->getResponse()->clearHeaders() ->setHeader('Content-Type', 'application/pdf'); $this->renderLayout(); } else { $this->_redirect('/'); } } My phtml: require

Tcpdf Hindi sentence display issue

不想你离开。 提交于 2019-12-11 04:36:14
问题 I am trying to create pdf file using tcpdf library in PHP Programming language. trying from yesterday but still getting ???????? instead of Hindi fonts. I am trying to display this sentence : प्रविष्टि कर कुल बिक्री मूल्य वेट के साथ भार(ग्रा) टिन मात्रा(सं) भुगतान का प्रकार विवरण जारीकर्ता कार्ड I have included 2 to 3 different Hindi fonts but getting only question marks only. If you have good example with Hindi language in tcpdf or mpdf please guide me how to do it. I have also used to set