Create PDF with text and images in Flutter

Updated 1 February 2024


PDF stands for “portable document format”.  Essentially, the format is used when you need to save files that cannot be modified but still need to be easily shared and printed. So we will create a PDF with text and images in flutter.

The PDF document is independent of application software, hardware as well as Operating System and it is helpful to create invoice, online resume, printing tickets and many more applications are there.

You may also check our flutter app development services.


First Create a new flutter project and then add following dependency packages in pubspec.yaml file.

pdf :- The Pdf creation library is simple to use and offer Widgets system similar to Flutter, It can create a full multi-pages document with graphics, images, and text.

printing :- The Printing plugin that allows Flutter apps to generate and print documents to compatible printers on Android, iOS, macOS, Windows, and Linux, as well as web print.

Code to Create User interface

Create the Stateless (CreatePdfMainPage) Widget and call from main.dart by the following code.

FloatingActionButton navigate to PDF preview page when user click on it.

Image.assets :- add image from the local directory, to use assets image add your image path in puspec.yaml file.

Preview of the UI :-


Code to Preview and print PDF

Lastly create a new stateless widget to preview and print the PDF (where the page is navigated after clicking on floating action button) and import the packages in this Preview page :-

Uint8List :- basically It is the List of integers where the values are in the List is 1 Byte or 8-Bits.

makePdf() :- asynchronous method that make the PDF preview layout and return the List of unsigned integers bytes (Uint8List), and following method performed :-



Thanks for reading this article ❤️

I hope this blog will help you to learn about create PDF in Flutter and you will be able to implement it. For more updates, make sure to keep following Mobikul Blogs to learn more about mobile app development.

Happy Learning ✍️

You can also check create pdf document in swift.


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home