Generate a PDF with PHP

preview_player
Показать описание
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:

Please consider supporting my channel:

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:

Dompdf package:

Sample image:

Thumbnail icon:

CSS:

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
Рекомендации по теме
Комментарии
Автор

What other techniques would you like to see a video on?

dave-hollingworth
Автор

Undoubtedly the best PHP instructor, making the trickiest PHP concepts feel as easy as ABC when you explain them. ❤

yacoubasawadogo
Автор

Nice video, comprehensible and straight to the point. Please upload more. You really help a lot of junior developer. Cheers.

collenzaligway
Автор

This is the part i like about web dev.
You teach a variety of things.
Not just the basics.

On my first internship i was asked to put capcha on a form. It took me few days

It was sorta overwhelming because. Because in courses they just teach you the basics
Which are not remotely close to real world scenarios.

dawnstar
Автор

Not gonna lie, You are the most nicest PHP instructor I've ever met in my life!

Your building REST Api, MVC Framework in PHP tuts are still relevant. Love your calm and smooth informative contents. Keep them coming 😀

alnahian
Автор

Let me told you something DAVE, "YOU ARE AWESOME TEACHER". Congratulations...Regards from Mexico.

GeorgeRoman
Автор

I wish I can create a million more accounts just to give you the like! You are too awesome, Dave. You're my favourite teacher.

inamrasluzd
Автор

Please make a tutoprial series on PHP object oriented programming, I really love the way you explain things

OnyeStephen
Автор

Thank you Dave. You're very knowledgeable on PHP.

abanwaraphael
Автор

great a clear and easy to understand video thank you so much. Would love to see a more complex form with lots of boxes and lines and shading.

gensys
Автор

Mpdf, emailing a pdf, logging into db, a more complex invoice with a twig/blade template and multiple elements, etc. But at the end of the day you are the best, as always thanks.

AliRianiDeO
Автор

Hi ! You always give us better understanding. Thanks for this video.

codeclassroom
Автор

excellent AS ALWAYS!! txs also 4 introducing water & gutenburg css!!

efbYouTube
Автор

Thank you Dave, another great apportation! As always...!

giorgiobarone
Автор

Dave, we are still waiting your new frameworks courses.
You are awesome teacher!

ilyamur
Автор

Thanks, really useful and well explained. I'll be experimenting with this as my case use was not covered. I'd like to batch convert several html files to pdfs and will try executing a suitable php script in bash without using a browser. It will depend on domphp having its own pdf creator rather than borrowing browser functionality.

batchrocketproject
Автор

Liked you video I am learning at very short time

laughandlivemixedcontentzo
Автор

Hi Dave, I would like to see spinner on input site while downloading PDF. Spinner should prevent user to input values into fields while downloading.

srdjanstankovic
Автор

idont get thoes lines, even if i copypase your hole code. i also downloaded gutenberg and linked it localy and no change.
just wondering why

mmcool
Автор

i am good until what you tought, can you please help me on how to pull data from data base table and show in a table format. thank you in advance..

karthikand_