Generate a PDF with PHP

Published: 06 June 2022
on channel: Dave Hollingworth
61,725
1.2k

Learn how to generate a PDF file using PHP.

PDF files are useful because the formatting is always reliable - its contents will always display in exactly the same way no matter where you are viewing it.

Full PHP course:
➤ https://davehollingworth.net/phpy

Please consider supporting my channel:
☕ https://ko-fi.com/davehollingworth

In this video you'll learn how to:
• use the Dompdf library to generate a PDF file
• make the browser download the file or open it inline
• add styling to the PDF content
• insert images
• insert user-supplied, dynamic content
• use inline, embedded and external CSS for styling
• save the generated PDF file locally

Also learn how to easily fix the common Dompdf problem when inserting images: "Image not found or type unknown".

Code shown in the video:
‣ https://gist.github.com/daveh/88ff8c5...

Dompdf package:
‣ https://github.com/dompdf/dompdf

Sample image:
‣ https://en.wikipedia.org/wiki/Service...

Thumbnail icon:
‣ https://www.flaticon.com/free-icons/pdf

CSS:
‣ https://watercss.kognise.dev/
‣ https://github.com/BafS/Gutenberg

00:00 Introduction
00:35 Install Dompdf
01:02 Basic PDF generation
02:49 Change PDF filename
03:25 Display PDF inline
04:21 Styling and layout
05:23 Images
06:14 Setting options 1
06:47 Setting options 2
07:36 Setting page options
08:16 Document metadata
09:08 Create the form
10:11 Classless CSS
10:42 Dynamic data
11:55 HTML template
16:19 Using CSS
17:52 Enable remote resources
18:13 Save PDFs locally
18:59 Summary

#PHP #PDF


Watch video Generate a PDF with PHP online without registration, duration hours minute second in high quality. This video was added by user Dave Hollingworth 06 June 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 61,725 once and liked it 1.2 thousand people.