Menu
  • HOME
  • TAGS

remove printing \r\n during output in tcpdf or php

php,tcpdf

You should escape slashes and, i think, replace with space to don't make as one word $html .= stripslashes(str_replace(array("\\r","\\n")," ", $address)); ...

Variable substitution within HEREDOC literal

php,html,pdf,tcpdf

You have don't need to close/open quotes for the variable. Use this code instead: $html = <<<EOD <div> </br> <img src="../tcpdf/pdffirst.png" width="500" height="800" alt=""/> <img src="../charts/$filename-most.png" width="500" height="250" alt=""/> </br> </div> EOD; ...

TCPDF writeHTMLCell new line issue

php,tcpdf

Oops. I didn't read the TCPDF Documentary which told me that the supported HTML type for carriage returns in WriteHTMLCell is "br"; so I modified my code from: Old Code $needles = array("<br>", "<br />", "<br/>", "\n"); $replacement = "&#13;"; $p_long_desc = str_replace($needles, $replacement, $p_long_desc); to: New Code $needles =...

Ghoscript: PDF/A or PDF/X → regular PDF?

pdf,tcpdf,ghostscript,pdfa

You can't use Ghostscript to 'convert' a PDF file, only to take a PDF as an input, and produce a new PDF as an output. If you simply pass the PDF as an input to Ghostscript, and use the pdfwrite device then it will produce an equivalent PDF for you,...

how to load blade view with tcpdf laravel 5?

pdf-generation,laravel-5,tcpdf

Try using $pdf->writeHTML(view('your.view')->render()); However, the functionnalities of writeHTML() method are limited, see TCPDF documentation. http://www.tcpdf.org/doc/code/classTCPDF.html#ac3fdf25fcd36f1dce04f92187c621407...

Saving File to Folder using PHP

php,dictionary,fopen,tcpdf

Use this : $a = file_get_contents('Text.pdf'); file_put_contents('new_text.pdf', $a); ...

Table Overflow columns are not showing in TCPDF

tcpdf

Print the page in portrait mode $pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);...

FPDF - How to remove a vertical line in the generated file

pdf,export,tcpdf,fpdf

I think you are using TCPDF instead of FPDF. So just disable the automated page header via the setPrintHeader() method.

TCPDF Justification Issue with Last Line of Paragraph

php,tcpdf

I don't think that there is a 'setting' to handle this; however, if you simply put a new line ("\n") at the end of your string it does exactly what I was looking for. So if anyone is having a similar problem, the answer (in my case) is to simply...

Javascript: How to create pdf file from HTML form or div

javascript,jquery,pdf,pdf-generation,tcpdf

I found the solution to my answer here - called Xportability / css2pdf Thanks for all the help....

TCPDF interactive pdf

php,pdf,tcpdf

You cannot fill in a PDF form with TCPDF but you only can create one. You may use FPDI to import the PDF form (without form fields!) and write to the positions of the form fields manually. If you need to fill in a PDF form with PHP you may...

PHPWord to PDF not able to load library

php,tcpdf,dompdf,phpword

Knowing al that, I'm guessing the answer is changing: $includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile; to $includeFile = Settings::getPdfRendererPath(); ...

CakePHP Shell Cronjob TCPDF

php,shell,cakephp,cron,tcpdf

The problem is that AppShell doesn't support view functional by default. So like in similar question, you have to add following: App::uses('View', 'Core'); $view = new View(); $view->set(compact('data', 'cmsoptions')); $view->layout = 'pdf'; $pdfContent = $view->render(); And then you can use $pdfContent as content of PDF file with help of file_put_contents('/var/www/new_invoice.pdf',...

passing one variable from one page to another for pdf generation

php,pdf,phpexcel,tcpdf

ok since I was on my own... I found solution by myself .... on the first page of PHP... session_start(); //rest of your code and then... if($_SERVER['REQUEST_METHOD'] == 'POST') { echo '<form action="final.php" method="POST">'; $tablo="<br />"; $tablo = $tablo."<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\" align='center'>"; for ($rowcount = $rowCompanyInfoStart; $rowcount <= $rowCompanyInfoEnd;...

TCPDF disregards width of earlier td if current td has long text

php,html,css,tcpdf

Still open for an answer I still haven't been able to find a definite better answer. I am posting this answer incase someone else is facing the same problem and is looking for urgent solution. <td style="width: 48%;text-align: left;"> <?php echo wordwrap($text, '70',"<br \>\n &nbsp;&nbsp;&nbsp;"); ?> <br /> <table> <tr>...

TCPDF Memory Issue Allowed memory size of 134217728 bytes exhausted

php,pdf,tcpdf,memory-limit

Add this line in the your code set_time_limit(0); and this ini_set('memory_limit', '-1');// its not the proper solution but it will do the trick. Or ini_set('memory_limit', '640M'); //Set Proper memory limit in your php file...

SetAutoPageBreak not working or I am not using it correctly

php,mysql,tcpdf,fpdf

You can try this: <?php require ('fpdf.php'); class PDF extends FPDF { // Page header function Header() { $this->SetFont('Arial', 'BI', 20); $this->Ln(5); $this->Cell(60); $this->Cell(190,10,'INCOME REPORT','B',1,'C',0); // Line break $this->Ln(5); } // Page footer function Footer() { // Position at 15 mm from bottom $this->SetY(-15); // Set font $this->SetFont('helvetica', 'I', 8);...

How can use internal css style in a tcpdf generated report for some table rows?

php,tcpdf

Use following code for library: // Include the main TCPDF library (search for installation path). require_once('tcpdf_include.php'); and set the following parameters for object definition // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); It will work. For detail description for tcpdf library you can refer...

Codeigniter - How to integrate TCPDF?

php,codeigniter,tcpdf

Finally found the answer I placed ob_clean(); before $pdf->Output('test.pdf','I'); That solved the issue. Thank you all for the help.

Not rendering svg file in TCPDF

php,svg,tags,tcpdf

The <object> element is not valid for SVG files. If you are trying to include an image, you should be using <image>. However I don't know whether TCPDF handles data URLs or not....

Arabic words in invoice pdf print Magento

magento,pdf,tcpdf,arabic

1) Don't edit core files. 2) There are multiple invoice generators in magento: invoice from the backend, invoice on success page etc. So make sure that you are editing and testing the right one. The example below works for invoices in the backend. 3) There may be custom modules that...

TCPDF - loop data in two columns layout

php,foreach,tcpdf

TCPDF - support multicolumns, this is wat i used to solve my issue: $pdf->AddPage(); $pdf->resetColumns(); $pdf->setEqualColumns(2, 84); // KEY PART - number of cols and width $pdf->selectColumn(); $content =' loop content here'; $pdf->writeHTML($content, true, false, true, false); $pdf->resetColumns() the code will add auto page break and continues to next page....

php tcpdf image string filter

php,tcpdf

Finally got it! explode() worked... Then instead of pdf->Image, I just put a temp. image for img tag's src attribute. get the string with getimagefromstring save a temp image from string then use img tag in $pdf->writeHTMLCell $base64 = explode(',', $col_value); $base64d = base64_decode($base64[1]); $im = imagecreatefromstring($base64d); if ($im !==...

TCPDF for PHP creates empty PDF when special (slovic) character đ is used

php,pdf,special-characters,tcpdf

David van Driessche has correctly identified the problem; the font in use doesn't support the đ character. A basic test (note that I saved this PHP script as a UTF8 file): require './tcpdf/tcpdf.php'; function write($pdf) { $pdf->Write(0, 'test đ ', '', 0, '', false, 0, false, false, 0); $pdf->writeHTML(trim(mb_convert_encoding('test2 đ',...

[Help]PHP to PDF [closed]

php,pdf,tcpdf,html2pdf

You can use wkhtmltopdf. example after you have download it,etc: wkhtmltopdf http://link.com file_name.pdf ...

Automatic Pagebreak in Dynamically generated TCPDF HTML page

php,pdf-generation,html-table,tcpdf,html-to-pdf

Found the solution. I had a TCPDF option misconfigured. Setting this made everything work as intended: $pdf->SetAutoPageBreak(true, 0); ...

header and footer line in FPDI/TCPDF

php,tcpdf,fpdi

You can use the Line method to draw a line in FPDF. If you want a straight horizontal line, just make sure the ordinates (y values) for the start and end of the line are the same. Something like this for example: $pdf->Ln(15,$pdf->y,200,$pdf->y); You would modify the values to suit...

Generate TCPDF output to a shared drive folder

php,pdf,path,directory,tcpdf

I found out that I can use this: $savedOutput = file_get_contents('SavedOutput.pdf'); file_put_contents('newSavedOutput.pdf', $saveOutput); I save the PDF into a folder, then get the content and save it to the shared folder ...

TCPDF produces “An error exists on this page.” in Acrobat with PNGs

php,pdf,png,tcpdf

I found a hack fix for my problem, but I’m not at the root of the issue yet. By removing the alpha mask from the generated .png at the end of TCPDF->ImagePngAlpha() I can now open the PDF with Acrobat. I removed $imgmask from the end of $this->Image($tempfile_plain, $x, $y,...

Fixing FONTFORGE Open type font validation errors / TCPDF

php,encoding,tcpdf,fontforge

i was a little mislead on tracking the error. The validation errors still do occure, but i had to adjust my TCPDF object with $pdf->setFontSubsetting(false); to prevent compacting the font....

TCPDF 6.0.047 - UTF-8 and time new roman font

php,utf-8,tcpdf

1) Fonts First, I copied my Windows8 "Times new roman" fonr from c:\windows\fonts to a temp dir under tcpdf/fonts called "tnr". There are 4 files "times.ttf", "timesbi.ttf", "timesbd.ttf", "timesi.ttf". 2) Then removed "times.php" from tcpdf/fonts 3) Remake the times font def and add the new bi (bold italic) with this...

How to add signature on a interactive pdf using adobe acrobat xi pro?

pdf,pdf-generation,tcpdf

You can find signature options in the menu pane that defaults to the right side of Acrobat. From Tools|Fill&Sign|Comment, select Fill&Sign, and then select "Place Signature" from the menu pane below it. You will be prompted to create a new signature.

tcpdf include external file with more tcpdf code in it?

php,include,external,tcpdf

You still need to have <?php ... ? blocks around the code in your files. Remember that there is no such thing as a "php script". There's only files which have php code blocks embedded in them. Without the <?php opening tag in your included file, the php interpreter will...

Why TCPDF instead of mpdf

php,tcpdf

@Trupti, Please check below points for your clarification regarding TCPDF & mPDF. 1. TCPDF is the best tool to create booklet covers or non-template based PDFs. It’s excellently supports SVG, PNG and another graphic formats. 2. If you would like to generate PDF’s based on some HTML templates — it’s...

Displaying an image in the header of a PDF using TCPDF

php,cakephp,tcpdf

Turns out the problem was that I had forgotten to remove the lines $pdf->setPrintHeader(false); For anyone else trying to use TCPDF with CakePHP - the paths to images are relative to the webroot - so in my case it was files/pdf_images/header.jpg...

TCPDF: Specific text size and custom text height

tcpdf

3mm is equivalent to 8.5pt, so yeah, 9pt font size should get you pretty close.

pdf file corrupted when try to forward mail from thunderbird/outlook

php,email,pdf,tcpdf,thunderbird

Used alternate solution to send pdf file in mail that is, store file on server, send email with attachment, remove file from server after mail send. Sample code $fileName = 'output.pdf'; $fileatt = $pdfObj->Output(SERVERPATH.'/output.pdf', 'F'); $filename = 'output.pdf'; $file = $naTmpPath.'/'.$filename; $file_size = filesize($file); $handle = fopen($file, "r"); $content...

Add main header on first page only in TCPDF

php,codeigniter,header,tcpdf

You can check examples of tcpdf and you can inherit TCPDF class and use that class: class YOUR_CLASS extends TCPDF { /** * Overwrite Header() method. * @public */ public function Header() { // if ($this->tocpage) or if ($this->page == 1) { // *** replace the following parent::Header() with your...

Looping array PHP can't work on pdf tcpdf

php,arrays,tcpdf

This is because your $htmllab variable is getting over written by each loop execution: Do this for($i=0;$i<count($yp);$i++) { $htmlab.= '<th style="text-align:center;" width="90">'.$yp[$i].'</th>'; } ...

html2pdf - TCPDF : word wrap in table cell using zero width space (replaced by '?' in PDF)

php,html,css,tcpdf,html2pdf

Solved this several days ago : found and used "mpdf". This one is awesome :) http://www.mpdf1.com/mpdf/index.php...

Generate PDF with base64 encode string

php,pdf-generation,tcpdf

I think you should use this code to get your pdf file : $data = base64_decode($this->Get(self::Body)); file_put_contents('mypdf.pdf',$data); Then you can open it. Or you can echo the content to your page like this : $data = base64_decode($this->Get(self::Body)); header('Content-Type: application/pdf'); echo $data; Good luck...

TCPDF class not found in Laravel

php,laravel-4,tcpdf

Although the class is loaded, things are treated a bit differently by Laravel's IOC container. See this answer posted to a similar question for a better explanation than I could have given. You should be able to adapt one of the various methods for this package. I'd recommend going the...

Urdu supported PDF library compatible with php

pdf,pdf-generation,tcpdf,fpdf

So this is what I did, I copied windows font ARIAL UNICODE MS and pasted into tcpdf/fonts/ folder. Then I ran following script from tcpdf/examples/ <?php require_once('tcpdf_include.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $fontname = TCPDF_FONTS::addTTFfont('../fonts/ARIALUNI.ttf', 'TrueTypeUnicode', '', 32); ?> This generated appropriate font files that could...

Declaration of MYPDF::Header() should be compatible with TCPDF::Header()

php,tcpdf

$pdf = new MYPDF('P', 'mm', 'A4'); $ecm="1241231.jpg"; $pdf->setECM($ecm); $pdf->Header(); $pdf->Output('filename.pdf', 'I'); //To force download } // Extend the TCPDF class to create custom Header and Footer class MYPDF extends TCPDF { public $ecm; public function setECM($ecm) { $this->ecm = $ecm; } //Page header public function Header() { $ecm = $this->ecm;...

TCPDF Image aspect ratio issue

php,tcpdf

Here's the solution I found : if ('' != $this->data['logo'] && is_file($this->data['logo'])) { // select only one constraint : height or width. 60x20 image emplacement => ratio = 3 (60/20) list($image_w, $image_h) = getimagesize($this->data['logo']); if (3 > $image_w / $image_h) list($w, $h) = array(0, 20); else list($w, $h) = array(60,...

Making bigger Logo in header of PDF using TCPDF

php,tcpdf

Basically.... public function Header() { // Logo $image_file = K_PATH_IMAGES.'easy.png'; $this->setJPEGQuality(90); $this->Image($image_file, 120, 0, 50, 40, 'PNG', '', 'T', true, 300, '', false, false, 0, false, false, false); // Set font $this->SetFont('helvetica', 'B', 20); // Title // $this->Cell(0, 15, ' ', 0, false, 'C', 0, '', 0, false, 'M', 'M');...

Save as PDF PHP page

php,pdf,tcpdf,dompdf

You can use DOMPDF for this and DOMPDF also supports PHP Code.You can enable php on dompdf_config.inc.php file DOMPDF_ENABLE_PHP = true by default it false.