Questions tagged [dompdf]

An HTML to PDF converter written in PHP

dompdf is an HTML layout and rendering engine written in PHP that can generate PDFs.

Features

  • handles most CSS 2.1 and a few CSS3 properties, including @import, @media & @page rules
  • supports most presentational HTML 4.0 attributes
  • supports external stylesheets, either local or through http/ftp (via fopen-wrappers)
  • supports complex tables, including row & column spans, separate & collapsed border models, individual cell styling
  • image support (gif, png (8, 24 and 32 bit with alpha channel), bmp & jpeg)
  • no dependencies on external PDF libraries, thanks to the R&OS PDF class
  • inline PHP support

Requirements

  • PHP 5.0.0+ (5.3 recommended)
  • MBString extension
  • DOM extension (bundled with PHP 5)
  • Some fonts.

The code is licensed under GNU Lesser GPL.

1980 questions
21
votes
2 answers

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

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…
vaindil
  • 7,536
  • 21
  • 68
  • 127
18
votes
11 answers

Laravel dompdf error "Image not found or type unknown"

I am getting error "Image not found or type unknown" after downloading PDF in Laravel 5.4 using dompdf package. Here is the method public function pdf() { $users = User::get(); $pdf = PDF::loadView('pdf', compact('users')); …
Ahsan
  • 1,289
  • 3
  • 13
  • 37
18
votes
12 answers

Dompdf error "No block-level parent found. Not good."

require_once("function/dompdf/dompdf_config.inc.php"); $dompdf = new DOMPDF(); foreach($modules as $module){ $output = "Hello " .$module['name']; $dompdf->load_html($output); $dompdf->render(); $output_pdf = $dompdf->output(); …
Eliana
  • 395
  • 3
  • 10
  • 20
18
votes
9 answers

How to get page number on dompdf PDF when using "view"

Ok, so I use the following snippet to get "views" of HTML with PHP variables loaded in as $data so that I can do things like fill in tr's of data from a database call or whatever. function getView ($file, $data=NULL) { if (!empty($data))…
SpYk3HH
  • 22,272
  • 11
  • 70
  • 81
17
votes
2 answers

How to set custom width and height of pdf using dompdf?

When I create my pdf using dompdf it generates it as default width and height. I want to set custom width and height of my created pdf. If it is not possible in dompdf then kindly suggest some other plugin for php.
Saurabh Gupta
  • 506
  • 1
  • 4
  • 18
17
votes
1 answer

Generate filename with creation date

I'm using dompdf to create and mail a PDF file to my mail and at the same time, save a .txt version on the server. Saving the file is working as it should, but im having a bit of trouble getting it to save it with a unique name. In this case i…
denully
  • 215
  • 1
  • 2
  • 8
17
votes
5 answers

Open PDF in a new tab using dompdf

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…
freeloader
  • 336
  • 2
  • 6
  • 18
16
votes
5 answers

dompdf special characters

I'm having successful html-to-pdf conversions, but not with special characters. Below is just a special character I'm trying to display, which displays in browsers on my Mac, when I put it simply inside an html document. (but not on my windows…
coffeemonitor
  • 12,780
  • 34
  • 99
  • 149
16
votes
5 answers

DOMPDF with css float

I am not sure why but the html page displays just fine but the dompdf does not utilize the floats. Code is 2300 + line long so to long to post here.... But it is all inline css.
I have tried both wrapping the css in…
Joshua Blevins
  • 183
  • 1
  • 2
  • 8
16
votes
1 answer

Can I pass data to the Codeigniter output class without displaying it?

I'm working on a way for users to be able to generate PDF copies of invoices and other tabular data. To do this, I've wrapped dompdf into a library that I can use with CI and created a method that will generate a PDF based on the return value of…
Tim Post
  • 33,371
  • 15
  • 110
  • 174
14
votes
7 answers

DOMPDF problem with Cyrillic characters

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…
14
votes
5 answers

DomPDF table fixed column width and break long text

I have a table with very long texts that has no spaces (users like to post a full website URL complete with all the parameters) Then I set on word-break:break-all; and word-wrap:break-word; on each hoping that the text could fit on the table. I…
topher
  • 1,357
  • 4
  • 17
  • 36
14
votes
2 answers

dompdf - scale the pdf to fit page

So I am using dompdf to create pdfs of html. Which works really good, the only problem is when the html is too big and dompdf creates it over two pages. Is there a way maybe in dompdf or in html to scale it to one page only? Help would be greatly…
Petros Mastrantonas
  • 806
  • 1
  • 15
  • 41
14
votes
2 answers

DomPDF does not render table nicely

I am trying to get PDF using DomPDF but I come cross a strange problem. All the data and other things are fine but when it renders in PDF the first line of the table is always out of style. Firstly, I though may be table is going to the next page…
RK.
  • 973
  • 5
  • 19
  • 45
14
votes
3 answers

CSS not working with DOMPDF

I am using DOMPDF (v 0.5.2) to convert an html page to a pdf file. The pdf file appears after the PHP script has run (as expected), but no styles are applied to any of the content. As far as I can find, the float property does not work with DOMPDF,…
Michael
  • 169
  • 2
  • 2
  • 9