fpdf

How to display a JSON/base64 encoded image in FPDF?

大憨熊 提交于 2019-11-29 11:57:47
I'm storing signatures (using signaturepad in my database Coldfusion/MySQL 5.0.88 and would like to output the signature I'm taking onto a pdf which I'm generating with fpdf . However I can*t get it to work... Signatures are stored like this: [{"lx":19,"ly":58,"mx":19,"my":57},{"lx":23,"ly":54,"mx":19,"my":58},{"lx":26,"ly":53,"mx":23,"my":54},{"lx":32,"ly":51,"mx":26,"my":53},{"lx":38,"ly":47,"mx":32,"my":51},{"lx":44,"ly":44,"mx":38,"my":47},{"lx":51,"ly":41,"mx":44,"my":44},{"lx":58,"ly":37,"mx":51,"my":41},{"lx":64,"ly":35,"mx":58,"my":37},{"lx":67,"ly":31,"mx":64,"my":35},{"lx":70,"ly":30

Set PDF to print with no scaling

北城以北 提交于 2019-11-29 09:33:35
I am generating a PDF (using fpdf) and I am wondering if there is a way to set the document's properties to to default to print with no scaling. So when you select print from the print dialogue menu, scaling is set to none. I'm trying to determine if this is a user setting or something I can control in the creation of the PDF. Thanks in advance. Scaling is controlled by the PDF application - it is not set in the file. I've done it adding to the method _putcatalog() the following: $this->_out('/ViewerPreferences [/PrintScaling/None]'); After the line: $this->_out('/Type /Catalog'); Implementing

FPDF error: Missing or incorrect image file

亡梦爱人 提交于 2019-11-29 08:33:58
I am using the FPDF library for generating PDF files by PHP. This library is working fine with plain text(i.e PDF files are generating for any text), but this is giving me an error of FPDF error: Missing or incorrect image file:{MY_FILE_PATH} while trying to add an image to my PDF page. Accessed that file path through the browser, then the corresponding image is appearing fine. My code is: require('fpdf.php'); $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 16); $pdf->Write(10, 'Example image'); $image_path = MY_FILE_PATH; // This variable contains my actual file path $pdf-

png images to one pdf in python

荒凉一梦 提交于 2019-11-29 08:09:02
I have a list of .png images. I need to convert all of them into one pdf, 9 images per page , but not to place them one after another vertically, but fill in all the width, and only then continue to next row. Amount of pictures can be different each time (12, ... 15) I have tried fpdf from fpdf import FPDF list_of_images = [1.png, 2.png, ... 15.png] w = 70 h = 60 pdf = FPDF(orientation = 'L') for image in list_of_images: pdf.image(image, w=sizew, h=sizeh) pdf.output("Memory_usage.pdf", "F") and also wkhtmltopdf template = Template('''<!doctype html> <html> <body> <div style="display: flex;

How to get the exact modified PDF using FPDF/FPDI?

拟墨画扇 提交于 2019-11-29 07:07:52
i have a task to modify the PDF and add an image into it, for which I Have used the FPDF and FPDI libraries.. whose action code is given below: <?php require_once('fpdf.php'); require_once('fpdi.php'); $pdf =& new FPDI(); $pdf->AddPage(); //Set the source PDF file $pagecount = $pdf->setSourceFile("Completed.pdf"); //Import the first page of the file $tpl = $pdf->importPage(1); //Use this page as template // use the imported page and place it at point 20,30 with a width of 170 mm $pdf->useTemplate($tpl, 20, 30, 170); #Print Hello World at the bottom of the page //Select Arial italic 8 $pdf-

php send e-mail with PDF attachment

那年仲夏 提交于 2019-11-29 06:01:35
I am creating pdf using FPDF . Pdf is generating perfectly and also pdf is available with email. But i want to send body message also. I have tried with body message. Example Fine text message This is text message from shohag But only pdf attachment is available and body is empty. Here is my code. function send_pdf_to_user(){ if($_REQUEST['action'] == 'pdf_invoice' ){ require('html2pdf.php'); $pdf=new PDF_HTML(); $pdf->SetFont('Arial','',11); $pdf->AddPage(); $text = get_html_message($_REQUEST['eventid'], $_REQUEST['userid']); if(ini_get('magic_quotes_gpc')=='1') $text=stripslashes($text);

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

How to create a password protected pdf file

女生的网名这么多〃 提交于 2019-11-29 00:43:10
I'm using html2fpdf for creating PDF documents. Now once I have created that, I want to make sure that the PDF file is password protected. How can this be done in PHP? Mohit Jain Download the library I am using from a blog post on the ID Security Suite site : <?php function pdfEncrypt ($origFile, $password, $destFile){ require_once('FPDI_Protection.php'); $pdf =& new FPDI_Protection(); $pdf->FPDF('P', 'in'); //Calculate the number of pages from the original document. $pagecount = $pdf->setSourceFile($origFile); //Copy all pages from the old unprotected pdf in the new one. for ($loop = 1; $loop

FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI

送分小仙女□ 提交于 2019-11-28 18:23:15
I am running the following code and giving me this error : FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI. I used another pdf named test.pdf and that works fine but it is giving me error in testcopy.pdf. I think this is parser problem. Anyone know any other parser that can be used with fpdf to avoid this error? My code: require('fpdf17/fpdf.php'); require('fpdf17/fpdi.php'); // initiate FPDI $pdf = new FPDI(); while (ob_get_level()) ob_end_clean(); header("Content-Encoding: None", true); // set 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(