tcpdf

TCPDF Custom page size

一曲冷凌霜 提交于 2019-11-29 06:04:13
问题 This example on tcpdf's website shows how to use page formats like A4, A5 etc, but how do I set tcpdf to use custom sizes like 175mm x 266 mm? Solutions appreciated. 回答1: EDIT : I was just wrong : you can give an array (array($width, $height)) in parameter.. I created a tcpdf subclass where I modified a few things : getPageSizeFromFormat(); Here is the code : http://paste.pocoo.org/show/294958/. Then I call my custom class, add a new format and set a new format : $pdf = new CUSTOMPDF(PDF_PAGE

TCPDF twice as slow as FPDF with same code

孤街浪徒 提交于 2019-11-29 03:40:21
问题 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

Changing or eliminating Header & Footer in TCPDF

南楼画角 提交于 2019-11-29 00:58:25
AddPage() in tcpdf automatically calls Header and Footer. How do I eliminate/override this? Brian Showalter Use the SetPrintHeader(false) and SetPrintFooter(false) methods before calling AddPage() . Like this: $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, 'UTF-8', false); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->AddPage(); A nice easy way to have control over when to show the header - or bits of the header - is by extending the TCPDF class and creating your own header function like so: class YourPDF extends TCPDF { public function Header() { if (count(

TCPDF Save file to folder?

天大地大妈咪最大 提交于 2019-11-28 19:13:32
I'm using TCPDF to print a receipt and then send it to customer with phpMailer, but I have a problem: I have no idea how to save the file into a pdf. I've tried this: // reset pointer to the last page $pdf->lastPage(); //Close and output PDF document $pdf->Output('kuitti'.$ordernumber.'.pdf', 'I'); $this->Output("kuitit"); try this $pdf->Output('kuitti'.$ordernumber.'.pdf', 'F'); Developer this stores the generated pdf file in your custom folder of your project $filename= "{$membership->id}.pdf"; $filelocation = "D:\\wamp\\www\\project\\custom";//windows $filelocation = "/var/www/project

to generate pdf download using tcpdf

五迷三道 提交于 2019-11-28 13:41:42
i am not able to generate pdf download,my code is as follows,can anyone tell me what is wrong with this code. include 'tcpdf.php'; $pdf = new TCPDF(); $pdf->AddPage('P', 'A4'); $html = '<html> <head></head> <body><table border="1"> <tr><th>name</th> <th>company</th></tr> <tr> <td>hello</td> <td>xx technologies</td> </tr> </table> </body> </html>'; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output(); ?> I have modified your code and it works. [TESTED] <?php require_once('tcpdf_include.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false)

TCPDF & mPDF error: Some data has already been output to browser, can't send PDF file

感情迁移 提交于 2019-11-28 13:34:56
The Problem: TCPDF & mPDF error: Some data has already been output to browser, can't send PDF file I gave up on trying to fix the error with TCPDF and installed mPDF only to get the same error when attempting to render the document to the browser. I can save the document just fine and have it displayed in the browser upon retrieval. Additionally, this error only presented itself after switching from my dev server to my host server. Works fine on DEV server (DEV server = WAMPSERVER, PROD server = Hostgator Linux). Troubleshooting: I've read the many volumes of other discussions around the

How to overlay HTML generated PDF on top of existing PDF?

强颜欢笑 提交于 2019-11-28 13:05:36
I'm looking to start with an initial PDF file, one that has graphics and text, and then take some html code which has dynamic values for some user input, generate that as a PDF, hopefully either using the initial PDF as a background, OR somehow running a PHP script afterwards to "merge" both PDF where one acts as a background to another. I have some code that renders an HTML formatted PDF: (using DOMPDF) $initialpdf = file_get_contents('file_html.html'); $initialpdf = str_replace(array( '%replaceText1%', '%replaceText2%' ), array ( $replaceText1, $replaceText2, ), $initialpdf); $fp = fopen(

How to generate multilingual content Pdf in PHP

穿精又带淫゛_ 提交于 2019-11-28 12:33:07
I am using TCPDF to generate multilingual content PDF in PHP. I am using TCPDF and using font 'cid0jp' but It is forcing user to download language pack for adobe reader. Is there any way to generate multilingual pdf without enforcing user to download any langauge pack? devOp Yes, there's a way. I just had the same issue. Why Adobe Reader is asking for the language pack i don't know. But i know that the best way to create multilingual PDFs is to use the Arial Unicode MS -Font which is included in windows. That's the font with the most characters according to wikipedia!! But there's no Bold or

Symfony 1.4 with TCPDF: How to retrieve data from a database and show it as a .pdf file?

旧城冷巷雨未停 提交于 2019-11-28 11:09:22
问题 I work with Symfony 1.4. I want to create a pdf file using TCPDF with the content of a query involving multiple tables. Here my code in the actions.class.php: public function executeTest() { $this->conflictos1s = Doctrine_Core::getTable('Conflictos1') ->createQuery('a') ->leftJoin('a.SectorActividadCiuTa7') ->leftJoin('a.RelacionConflictualPrincipalTa9') ->leftJoin('a.SubsectorActividadTa8') ->leftJoin('a.DemandasTa2') ->leftJoin('a.ActoresTa1') ->leftJoin('a.Conflictos1HasActoresTa1') -

TCPDF ERROR: [Image] Unable to get image

非 Y 不嫁゛ 提交于 2019-11-28 09:41:05
I'm using TCPDF with Drupal's print module to generate PDF of articles, & ending up with following error message when I click the link to generate PDF: TCPDF ERROR: [Image] Unable to get image: http://localhost/pathToDrupal/themes/bartik/logo.png The Image exists in the location specified. I tried applying: allow_url_fopen = On; allow_url_include = On; in php.ini but that could not resolve the problem. Please care to help :( Apparently the "fopen"-wrappers are not used by TCPDF. If you supply the URL of an image, TCPDF tries to download it with cURL into the "cache"-directory where your TCPDF