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
10
votes
5 answers

Debug iconv_strlen error - PHP 5.5

I am trying to export a document to PDF using Laravel & DomPDF. This works on my mac, but not on staging or live server. Error as follows: I have no idea what this means, and cannot find any solutions. iconv_strlen(): Wrong charset, conversion…
Gravy
  • 12,264
  • 26
  • 124
  • 193
9
votes
3 answers

How to add page number for every page in laravel dompdf?

I get from here : https://github.com/barryvdh/laravel-dompdf My controller is like this : public function listdata() { $pdf=PDF::loadView('print_tests.test_pdf'); $pdf->setPaper('L', 'landscape'); return…
samuel toh
  • 6,836
  • 21
  • 71
  • 108
9
votes
4 answers

Merging two a5 pages into a singe a4 page (without using pdfnup)

I am using Dompdf to generate A5 pdf documents from a html template and Pdfnup (Part of Pdfjam) to combine them into a nice single A4 sheet, which helps saving some paper when printing :) # Generate an a5 pdf php dompdf.php mytemplate.html -p 'A5'…
Andrea Fiore
  • 1,628
  • 2
  • 14
  • 18
9
votes
3 answers

How to make pdf exact 10CM width with DOMPDF and Laravel?

I am creating a PDF with DOMPDF and laravel. The pdf is being printed with a special printer that only accepts files with 10CM width and 20CM height. I have tried this: $customPaper = array(0,0,720,1440); $pdf =…
Rubberduck1337106092
  • 1,294
  • 5
  • 21
  • 38
9
votes
2 answers

DOMPDF page orientation both landscape and portrait

In HTML formed sheet 3 . Each sheet is a table . We need something to convert to pdf with the last leaf was in a landscape ! With portraits it works, and how to make one of the sheets of the album .... I do not understand ...
9
votes
3 answers

How to include the external style sheet in dom pdf

I am using Dompdf for the report generation in the php. I am not able to include the external style sheet for the same... The code I am using is similar to the following:
Kiran
  • 551
  • 2
  • 7
  • 13
8
votes
2 answers

Save and download PDF

I need to do 2 things together & at the same time with DOMPDF. I need to do the following together - is this possible? //print the pdf file to the screen for saving $dompdf->stream("pdf_filename_".rand(10,1000).".pdf", array("Attachment" =>…
user991830
  • 864
  • 5
  • 17
  • 35
8
votes
8 answers

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

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.
Pedro
  • 242
  • 2
  • 4
  • 10
8
votes
1 answer

How to setting landscape in laravel-dompdf?

I get reference from here : https://github.com/barryvdh/laravel-dompdf My controller code is like this : public function listdata() { $pdf=PDF::loadView('pdf.test_pdf'); return $pdf->stream('test_pdf.pdf'); } I try setting landscape in…
samuel toh
  • 6,836
  • 21
  • 71
  • 108
8
votes
5 answers

background image doesn't show in dompdf

For some reason, the background image doesn't show in dompdf no matter what I try. I've put the direct url as well. None of them worked. Can someone with dompdf experience tell me what I need to do? It's important to note that other images…
Refiking
  • 641
  • 3
  • 10
  • 18
8
votes
4 answers

Save PDF file with Dompdf

using Dompdf to store data in pdf file: This function work fine : $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML('

Test

'); return $pdf->stream(); Now,when try $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML('

Test

pavlenko
  • 625
  • 2
  • 11
  • 30
8
votes
8 answers

DOMPDF - Class 'Font' not found

I'm trying to add a font via Command line. Every time I try i get the following error. Fatal error: Class 'Font' not found in /home/scripts/public_html/MarketingPalv2/load_font.php on line 139 I also get a similar error when I try to use…
David Allen
  • 1,123
  • 2
  • 10
  • 24
8
votes
1 answer

DomPDF output is broken when I use persian text

I'm using DomPDF and PHP to create PDF Files. When the text is English everything is ok, but when I want to convert Persian text, output is broken this is the example file that contains Persian and English text:
8
votes
12 answers

Image is not shown in PDF file using dompdf

I am using DOMPDF to convert the html into PDF and after converting I'm sending that PDF file to user mail id. Everything is working perfectly but in PDF file I am not able to see the image of logo of my site. I also searched in stackoverflow for…
Rakesh Shetty
  • 4,548
  • 7
  • 40
  • 79
7
votes
1 answer

PDF attachment not showing in mailtrap HTML output but showing in RAW section - Laravel 5.7

I find out that the Pdf I attached to my email does not show when delivered to my email in Mailtrap but it shows in the RAW data section. My Controller Method to send an email: public function store(Request $request) { $this->validate($request,…
OlaJ
  • 608
  • 7
  • 15