dompdf

Open PDF in a new tab using dompdf

谁都会走 提交于 2019-11-30 11:33:05
Im trying to generate pdf using dompdf, how can I open the pdf in a new tab in a browser? Like, I Click A link for the PDF and it should open in a new tab, not save it automatically. I want to give the user a choice to save the file after seeing it first. how do i do that? whenever i use $pdf->output at the end of the file, it does not change a thing, the file is still downloaded automatically. please help. thanks. Whether a PDF is downloaded or viewed in the browser depends on a couple of factors. One is your browser settings, but we have no control there. The second is how dompdf present the

Adding header and footer with page number in dompdf

风格不统一 提交于 2019-11-30 07:24:12
I am working with Codeigniter and I successfully implemented dompdf for generating PDF files. Now I have issues on adding a header and footer in generated PDF. Here is the my dompdf_helper code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); function pdf_create($html, $filename='', $stream=TRUE) { require_once("dompdf/dompdf_config.inc.php"); $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->set_paper("A4"); if ($stream) { $dompdf->stream($filename.".pdf",1); } else { return $dompdf->output(); } } ?> Here is the my controller to call PDF

dompdf fails to load

假如想象 提交于 2019-11-30 04:26:39
I am trying to get dompdf running on an in-house server. With the default config.inc.php settings, I get the following when running the equivalent of the demo 'Hello Wolrd' script: Warning: require_once(/var/www/dompdf-master/lib/php-font-lib/classes/font.cls.php): failed to open stream: No such file or directory in /var/www/dompdf-master/dompdf_config.inc.php on line 335 Fatal error: require_once(): Failed opening required '/var/www/dompdf-master/lib/php-font-lib/classes/font.cls.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/dompdf-master/dompdf_config.inc.php on line 335

How to create several pages with dompdf

独自空忆成欢 提交于 2019-11-30 01:57:15
问题 I am having some trouble with multidimensional array and its value. What i am looking for is , from my query I am searching teachers name in the array. And after that i want to create a pdf using dompdf. The problem is with looping. I am not able to create a proper loop which will work the way I want it to work. My sample query is $q11 = "select id from teachers order by teacher "; $r11 = mysql_query($q11) or die(mysql_error()); while($rows11 = mysql_fetch_array($r11)){ $teacher = $rows11['id

Print margins in DOMPDF

三世轮回 提交于 2019-11-30 00:52:07
问题 I'm trying to generate a PDF using DOMPDF. I have some HTML which is then converted into a PDF. But I have a problem. When I put an object at the top of the page (e.g. an icon), in the PDF it's also show on the top of the page. But when I print the PDF there is a margin. I know that there has to be a minimal margin, but in my case it's just too large. Is there some way to control this margin in DOMPDF? I'm trying to reproduce an existing document and in the original the logo is not on the top

dompdf Page break if element is exceeding page height?

心已入冬 提交于 2019-11-29 21:20:22
What is the best way to do page breaks in dompdf? I have had a look here at the page-break-before css attribute, but it didn't work when I did: table {page-break-before:auto;} The page still breaks in the middle of my table. Is it possible to setup my html/css so that the page will break before the element if the element is going to exceed the page height? Ideally I would like to divide my html up in to div sections so that each section will start on a new page if it is going to exceed the height of the current page. BrianS Using page-break-inside: auto; basically says to dompdf "do what you

DOMPDF, I cannot create two pdf at time

半城伤御伤魂 提交于 2019-11-29 18:13:43
When i try to create two pdf at a time it's throwing errors... Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'No block-level parent found. Not good.' in C:\wamp\www\si2i\application\libraries\dompdf\include\inline_positioner.cls.php on line 38 ( ! ) DOMPDF_Exception: No block-level parent found. Not good. in C:\wamp\www\si2i\application\libraries\dompdf\include\inline_positioner.cls.php on line 38 here is the code: $this->load->library('pdf'); $this->pdf->set_base_path($data['path']); $this->pdf->load_view('adm/invoice/si2i',$data); $this->pdf->render(); $output = $this->pdf-

dompdf and img tag, image wont show

旧巷老猫 提交于 2019-11-29 14:14:50
Here is the HTML just before $dompdf->render() and $dompdf->output() are called: <img src="http://www.example.com/images/Logo.png" /> All other invoices display the image fine when viewing in the browser, or printing it, or emailing it as HTML. When I click 'Generate PDF' inside of our application, it renders the invoice in PDF, except the logo is missing. I have put a debugging line in to email me the raw HTML it sends to the render(), and it looks fine to me. Does anyone have any idea why dompdf won't display this image? An idea: if you are providing full URI to the image it is treated as

DOMPDF loadView() error - undefined variable: data

本小妞迷上赌 提交于 2019-11-29 14:07:53
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 the error: ErrorException (E_UNKNOWN) Undefined variable: data I'm not sure why the loadView() method is

dompdf page number

女生的网名这么多〃 提交于 2019-11-29 04:39:06
Hi I am using DOMPDF to generate PDF file, I would like to know how to get page number. I have try the following as mention in FAQ page of DOMPDF. and not successful. NOTE: I also have turn on inline PHP as well as it mention in FAQ following is my code <?php require_once("dompdf/dompdf_config.inc.php"); ob_start(); //be sure this file exists, and works outside of web context etc.) $dompdf = new DOMPDF(); $html=" <script type='text/php'>"; if ( isset($pdf) ) { $font = Font_Metrics::get_font("yourfont", "normal"); $size = 9; $y = $pdf->get_height() - 24; $x = $pdf->get_width() - 15 - Font