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
78
votes
3 answers

how to save DOMPDF generated content to file?

I am using Dompdf to create PDF file but I don't know why it doesn't save the created PDF to server. Any ideas? require_once("./pdf/dompdf_config.inc.php"); $html = ''. '

Put your html here, or generate it with your…

TomTom
  • 1,113
  • 1
  • 10
  • 20
50
votes
2 answers

Print margins in DOMPDF

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…
cyrodiil
  • 545
  • 1
  • 4
  • 8
48
votes
5 answers

dompdf Page break if element is exceeding page height?

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…
startupsmith
  • 5,554
  • 10
  • 50
  • 71
46
votes
5 answers

DOMpdf, adding a new page to PDF

Is it possible to add a new page in DOMpdf? Similar to mPDF AddPage(); functionaly. I can't seem to find anything in the documentation, is there any work around to this? I can't seem to find anything in the documentation.
Kitalpha
  • 507
  • 1
  • 5
  • 10
45
votes
5 answers

Header in PDF page using DOMPDF in PHP

I am creating a PDF file using DOMPDF. I have a big content to extract in PDF, we need some header in all the pages. So can anyone telme how to add a header and footer in the PDF so that the header will shown in all the pages using DOMPDF.
Sandy
  • 525
  • 2
  • 9
  • 17
43
votes
11 answers

Dompdf and set different font-family

When generating a PDF it totally ignores my font-family attribute applied to my CSS. Instead of say Verdana, it uses Times New Roman. So my CSS look like: .sub-header { font-size: 1.4rem; text-transform: uppercase; font-family:…
John
  • 2,900
  • 8
  • 36
  • 65
35
votes
11 answers

DomPDF: Image not readable or empty

For some reason, DomPDF won't render an image included in the html that is being parsed: However, the image is rendered on the page when it is returned as html: I've looked at these issues and have make sure that DOMPDF_ENABLE_REMOTE is set to…
user3562712
31
votes
3 answers

Custom Fonts for DOMPDF

I'm Using DOM PDF 0.6.0 Beta 2. I want to use custom fonts (Fonts: 'Segeo Print', 'Lucida Handwriting','Airplanes in the Night Sky') in PDF file. I followed the guidelines to install and use fonts in my PHP Code, which is given here…
pinaldesai
  • 1,835
  • 2
  • 13
  • 22
29
votes
3 answers

dompdf HTML to PDF - can't set margin of page

version: 0.6.0 beta 3 I tryed in every manner to make dompdf set the margin of the page. I have a long page with a lot of text, divided in chapters... my css is something like: #wrapper{ padding:8px; } /* other styles... */ @page{margin: 0.2in…
Nereo Costacurta
  • 7,693
  • 4
  • 21
  • 27
29
votes
3 answers

PHP-font-lib must either be installed via composer or copied to lib/php-font-lib

i'm trying to convert some html to pdf. After some google search i find dompdf but when i try to convert i retrieve PHP-font-lib must either be installed via composer or copied to lib/php-font-lib This is what i'm trying to do: require…
Jayyrus
  • 12,961
  • 41
  • 132
  • 214
28
votes
3 answers

view pdf without downloading using dompdf

I generated a PDF using the dompdf library and used this: $dompdf->stream('my.pdf',array('Attachment'=>0)); to force the browser to let the user view the PDF before downloading. But it's not working. A Google search isn't bringing up any answers…
OJuice
  • 435
  • 2
  • 6
  • 11
28
votes
11 answers

dompdf character encoding UTF-8

Im trying to create pdf with correct characters, but there are "?" chars. I created a test php file, where Im trying to fing the best solution. If Im open in the browser the html I looks like ok UTF-8 --> UTF-8 : X Ponuka číslo € černý Češký But…
lostika
  • 379
  • 1
  • 5
  • 15
28
votes
7 answers

dompdf fails to load

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:…
Mark T. Johns
  • 381
  • 1
  • 3
  • 4
27
votes
3 answers

Displaying pdf from arraybuffer

I am returning stream data from laravel dompdf from this code $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML("
This is test
"); return $pdf->stream(); And this is my JS ajax code $.ajax({ type:"GET", url:…
GRESPL Nagpur
  • 2,048
  • 3
  • 20
  • 40
27
votes
26 answers

Dompdf remote image is not displaying in pdf

On my server pdf generated via dompdf was not displaying images. Because they are remote url images.(local images are working fine) then I come to know that it needs some settings to render remote images. allow_url_fopen = true => i can not as…
TechCare99
  • 1,763
  • 6
  • 24
  • 33
1
2 3
99 100