dompdf

DOMPDF loadView() error - undefined variable: data

痞子三分冷 提交于 2019-12-18 07:54:12
问题 I'm currently trying to incorporate the DOMPDF Wrapper for Laravel into my project, however I'm having troble figuring out how to pass a variable into the PDF template. As per the instructions, in my controller I have: //PrintController.php $data = array('name'=>'John Smith', 'date'=>'1/29/15'); $pdf = PDF::loadView('contract', $data); return $pdf->stream('temp.pdf'); and in my view: //contract.php ... <p><?php echo $data->name ?><p> <p>Signature</p> But when I try to render the page, I get

file_put_contents: Failed to open stream, no such file or directory

那年仲夏 提交于 2019-12-17 19:38:54
问题 I am trying to use dompdf to save a form to an easily-readable .pdf file, and my processing script is below. I am receiving the error Warning: file_put_contents(/files/grantapps/NAME0.pdf) [function.file-put-contents]: failed to open stream: No such file or directory in /home/username/public_html/subdir/apps/dompdf/filename.php on line 39 . (Line 39 is the final line in my full script.) I don't know how to resolve this issue. allow_url_fopen is on, and I have tried all kinds of file paths,

DOMPDF problem with Cyrillic characters

丶灬走出姿态 提交于 2019-12-17 18:25:24
问题 I am using the DOMPDF library to create an invoice in PDF. This document can be in French, Russian or English, but I am having trouble printing Russian characters. First, I tried to use UTF-8 encoding and placed the meta tag in the head of the HTML page to be converted: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> But that didn't work. Then I inserted this meta tag inside the BODY tag, and it helped solve the problem with French characters. But Russian characters

PDF not store inside the folder using php

那年仲夏 提交于 2019-12-16 18:06:33
问题 I tried to store my pdf file inside the folder in database.but it works only MAMP server.My code is below: $dompdf->load_html($html); $dompdf->set_paper("A4", "landscape"); $dompdf->render(); $dompdf->stream($projectdetail->project_name." - Cost Report.pdf", array("Attachment" => false)); $canvas = $dompdf->get_canvas(); $font = Font_Metrics::get_font("helvetica", "bold"); $canvas->page_text(750, 570, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 6, array(0,0,0)); $canvas->page_text(25, 570, "II

cannot open pdf file generated using dompdf

你离开我真会死。 提交于 2019-12-14 03:44:30
问题 i am trying to generate a pdf file from smarty template using dompdf:code is below:- require_once('dompdf/dompdf_config.inc.php'); $dompdf = new DOMPDF(); $dompdf->load_html($smarty->fetch(CURRENT_TEMPLATE.'/module/shopping_cart.html')); $dompdf->render(); $dompdf->stream("sample.pdf"); a pdf file is generated,but when i try to open the pdf file a error message is displaying as below "Acrobat cannot open the 'sample.pdf' because it is either not supported file type or because file has been

How can I get the total number of pages in DOMPDF?

大兔子大兔子 提交于 2019-12-14 03:41:31
问题 For example Page 1 of 5 . There's an example online of how to get teh Page 1 part but not the of 5 part. This is it: .pagenum:before { content: "Page " counter(page); } I'm using version 0.6 and $PAGE_NUM and $PAGE_COUNT does not work. 回答1: By default, inline PHP is disabled for security reasons, you need to enable it yourself in dompdf_config.custom.inc.php. See here. For now, total page count is not supported with the CSS you are using, we are planning to make it work in 0.6 final though.

DOMPDF not downloading file when using AJAX

南楼画角 提交于 2019-12-13 20:29:07
问题 I'm trying to work with the BarryVdh/DOMPDF code in my Laravel project. I made a page with a print button, with <a href="/print-facturen" class="btn btn-default printbtn">Print</a> This is calling the controller function : public function printFacturen(Request $request) { $facturen = Factuur::all(); view()->share('facturen', $facturen); $pdf = PDF::loadView('pdf.facturen'); return $pdf->download('invoice.pdf'); } This is successfully downloading the PDF file. My route is : Route::get('/print

Processing dynamic PHP variable output with domPDF

泪湿孤枕 提交于 2019-12-13 19:42:57
问题 I've been working on a script where the I should create a PDF from a dynamically created data from a page. After some research, I've decided to use domPDF. I currently use CodeIgniter as my framework so I came up with this tutorial. So from this tutorial, I got the following set of codes for the controller. Controller: dompdf_test.php - This will be used for generating the actual PDF based on the loaded view. class Dompdf_test extends CI_Controller { public function index() { // Load all

Dompdf prints html bootstrap code as col-sm-x and not as col-lg-x

只愿长相守 提交于 2019-12-13 19:13:47
问题 I am using Dompdf in PHP in order to print reports in PDF format. I can't figure out how to print an HTML bootstrap code the way I see it on my screen. For example, you know that bootstrap grid collapses if the device is smaller. In this case, in my PDF, the grid appears as though it were inside a mobile or table, like col-xs-x or col-sm-x instead of col-lg-x . Is there a way to specify in Dompdf that the view should look like in col-lg-x ? This is the sample html bootstrap code: $content2='<

PrestaShop libraries replacement

﹥>﹥吖頭↗ 提交于 2019-12-13 10:19:54
问题 I use PrestaShop 1.6.1.4 and I want to change the library tcpdf with dompdf. I use this form for creating invoices. What are the best practices for a library exchange? 回答1: I created inside override the tools folder and I put us dompdf-master found here https://github.com/dompdf/dompdf. Instead inside override/classes/pdf i copied PDFGenerator.php, there is in classes/pdf. In PDFGenerator.php add: require_once('/../override/tools/dompdf-master/dompdf/Dompdf.php'); require_once('/../override