How to Create PDF/A Standard Files in Flutter | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (179).NET Core  (28).NET MAUI  (215)Angular  (112)ASP.NET  (51)ASP.NET Core  (83)ASP.NET MVC  (90)Azure  (41)Black Friday Deal  (1)Blazor  (229)BoldSign  (15)DocIO  (24)Essential JS 2  (109)Essential Studio  (200)File Formats  (69)Flutter  (133)JavaScript  (226)Microsoft  (120)PDF  (82)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (949)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (45)Webinar  (52)Windows Forms  (61)WinUI  (71)WPF  (163)Xamarin  (160)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (9)Business intelligence  (55)Button  (4)C#  (158)Chart  (141)Chart of the week  (55)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (71)Development  (663)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (14)Excel  (43)Extensions  (23)File Manager  (7)Gantt  (19)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (513)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (4)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (14)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (113)UI  (393)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (620)What's new  (334)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
How to Create PDF/A Standard Files in Flutter

How to Create PDF/A Standard Files in Flutter

The Syncfusion Flutter PDF Library allows users to create and edit PDF documents in a Flutter application. You can also create various PDF conformance documents. In this blog, we will take a brief look at the PDF conformance levels followed by the procedure to create PDF documents with different conformance levels.

Transform your PDF files effortlessly in C# with just five lines of code using Syncfusion's comprehensive PDF Library!

PDF/A is an ISO-standardized version of the PDF, specialized for use in the archiving and long-term preservation of electronic documents to preserve text, vector graphics, raster images, and related metadata. This PDF/A conformance comes in different variants. At present our Flutter PDF Library supports creating PDF documents with the following conformance levels:

  • PDF/A-1B
  • PDF/A-2B
  • PDF/A-3B


PDF/A-1 was the first archiving standard. It was published in 2005 as ISO 19005-1. It is based on PDF 1.4 and imposes some restrictions regarding the use of color, fonts, annotations, transparencies, and other elements.


PDF/A-2 was published in 2011 as ISO 19005-2. It is based on PDF version 1.7, which has been standardized as ISO 32000-1. It makes use of the new features in this version. PDF/A-2 allows JPEG2000 compression, transparent elements, and PDF layers. PDF/A-2 also allows you to embed OpenType fonts and supports PAdES. One important innovation is the container function: PDF/A files can be embedded within a PDF/A-2 document.


PDF/A-3 has been available since October 2012. A PDF/A-3 document allows you to embed any format file in a PDF document desired—not just PDF/A documents. For example, a PDF/A-3 file can contain the original file from which it was generated. The PDF/A standard does not regulate the suitability of these embedded files for archiving.

 Level B conformance ensures that the visual appearance of a document is preservable long term, that the document will look the same when it is viewed or printed at any time in the future.

In this blog, we are going to cover the creation of the following conformance-level documents programmatically:

Create PDF/A-1B file

With the Syncfusion Flutter PDF Library, you can create a PDF document with PDF/A-1B standard. Here’s the procedure to do so:

Step 1: Create a Flutter application.

Follow the instructions provided in this Getting Started documentation to create a basic Flutter application.

Step 2: Add the Syncfusion Flutter PDF dependency.

Include the Syncfusion Flutter PDF package dependency in the pubspec.yaml file in your project.

Refer to the following code.

  syncfusion_flutter_pdf: ^18.4.30-beta

Step 3: Get the package.

Run the following command to get the required package.

$ flutter pub get

Step 4: Import the package

Import the PDF package into main.dart file using the following code example.

import 'package:syncfusion_flutter_pdf/pdf.dart';

Step 5: Create PDF/A-1B conformance document.

  1. Add a button widget as a child to your container widget, as shown in the following code example.
    Widget build(BuildContext context) {
      return Scaffold(
          appBar: AppBar(
            title: Text(widget.title),
          body: Center(
            child: Column(
              children: <Widget>[
                Text('Choose the conformance level:'),
                  children: [
                    Row(children: [
                          groupValue: _groupValue, onChanged: _changed, value: 0),
                      Text('PDF/A-1B', style: TextStyle(fontSize: 16))
                    Row(children: [
                          groupValue: _groupValue, onChanged: _changed, value: 1),
                      Text('PDF/A-2B', style: TextStyle(fontSize: 16))
                    Row(children: [
                          groupValue: _groupValue, onChanged: _changed, value: 2),
                      Text('PDF/A-3B', style: TextStyle(fontSize: 16))
                  child: Text(
                    'Create PDF',
                    style: TextStyle(color: Colors.white),
                  onPressed: _conformancePDF,
  2. Include the following code in the button click event to create a PDF/A-1B document.
    //Create a new PDF document with conformance A1B.
    PdfDocument document =
        PdfDocument(conformanceLevel: PdfConformanceLevel.a1b);
    //Add page to the PDF.
    final PdfPage page = document.pages.add();
    //Get page client size.
    final Size pageSize = page.getClientSize();
    //Draw rectangle.
        bounds: Rect.fromLTWH(0, 0, pageSize.width, pageSize.height),
        pen: PdfPen(PdfColor(142, 170, 219, 255)));
    //Read font file.
    List<int> fontData = await _readData('Roboto-Regular.ttf');
    //Create a PDF true type font.
    PdfFont contentFont = PdfTrueTypeFont(fontData, 9);
    PdfFont headerFont = PdfTrueTypeFont(fontData, 30);
    PdfFont footerFont = PdfTrueTypeFont(fontData, 18);
    //Generate PDF grid.
    final PdfGrid grid = _getGrid(contentFont);
    //Draw the header section by creating text element.
    final PdfLayoutResult result =
        _drawHeader(page, pageSize, grid, contentFont, headerFont, footerFont);
    //Draw grid.
    _drawGrid(page, grid, result, contentFont);
    //Add invoice footer.
    _drawFooter(page, pageSize, contentFont);
    //Save and dispose the document.
    final List<int> bytes =;
  3. The following code example is used to create the invoice header with basic information.
    PdfLayoutResult _drawHeader(PdfPage page, Size pageSize, PdfGrid grid,
          PdfFont contentFont, PdfFont headerFont, PdfFont footerFont) {
        //Draw rectangle.
            brush: PdfSolidBrush(PdfColor(91, 126, 215, 255)),
            bounds: Rect.fromLTWH(0, 0, pageSize.width - 115, 90));
        //Draw string.'INVOICE', headerFont,
            brush: PdfBrushes.white,
            bounds: Rect.fromLTWH(25, 0, pageSize.width - 115, 90),
            format: PdfStringFormat(lineAlignment: PdfVerticalAlignment.middle));
            bounds: Rect.fromLTWH(400, 0, pageSize.width - 400, 90),
            brush: PdfSolidBrush(PdfColor(65, 104, 205)));
  4. Add the invoice data in a tabular format with five columns using Syncfusion PDF tables.
    //Create PDF grid and return.
      PdfGrid _getGrid(PdfFont contentFont) {
        //Create a PDF grid.
        final PdfGrid grid = PdfGrid();
        //Specify the column count to the grid.
        grid.columns.add(count: 5);
        //Create the header row of the grid.
        final PdfGridRow headerRow = grid.headers.add(1)[0];
        //Set style. = PdfSolidBrush(PdfColor(68, 114, 196)); = PdfBrushes.white;
        headerRow.cells[0].value = 'Product Id';
        headerRow.cells[0].stringFormat.alignment =;
        headerRow.cells[1].value = 'Product Name';
        headerRow.cells[2].value = 'Price';
        headerRow.cells[3].value = 'Quantity';
        headerRow.cells[4].value = 'Total';
        _addProducts('CA-1098', 'AWC Logo Cap', 8.99, 2, 17.98, grid);
            'LJ-0192', 'Long-Sleeve Logo Jersey,M', 49.99, 3, 149.97, grid);
        _addProducts('So-B909-M', 'Mountain Bike Socks,M', 9.5, 2, 19, grid);
            'LJ-0192', 'Long-Sleeve Logo Jersey,M', 49.99, 4, 199.96, grid);
        _addProducts('FK-5136', 'ML Fork', 175.49, 6, 1052.94, grid);
        _addProducts('HL-U509', 'Sports-100 Helmet,Black', 34.99, 1, 34.99, grid);
        final PdfPen whitePen = PdfPen(PdfColor.empty, width: 0.5);
        PdfBorders borders = PdfBorders();
        borders.all = PdfPen(PdfColor(142, 179, 219), width: 0.5);
        grid.rows.applyStyle(PdfGridCellStyle(borders: borders));
        grid.columns[1].width = 200;
        for (int i = 0; i < headerRow.cells.count; i++) {
          headerRow.cells[i].style.cellPadding =
              PdfPaddings(bottom: 5, left: 5, right: 5, top: 5);
          headerRow.cells[i].style.borders.all = whitePen;
        for (int i = 0; i < grid.rows.count; i++) {
          final PdfGridRow row = grid.rows[i];
          if (i % 2 == 0) {
   = PdfSolidBrush(PdfColor(217, 226, 243));
          for (int j = 0; j < row.cells.count; j++) {
            final PdfGridCell cell = row.cells[j];
            if (j == 0) {
              cell.stringFormat.alignment =;
                PdfPaddings(bottom: 5, left: 5, right: 5, top: 5);
        //Set font = contentFont;
        return grid;
      //Create and row for the grid.
      void _addProducts(String productId, String productName, double price,
          int quantity, double total, PdfGrid grid) {
        final PdfGridRow row = grid.rows.add();
        row.cells[0].value = productId;
        row.cells[1].value = productName;
        row.cells[2].value = price.toString();
        row.cells[3].value = quantity.toString();
        row.cells[4].value = total.toString();
      //Get the total amount.
      double _getTotalAmount(PdfGrid grid) {
        double total = 0;
        for (int i = 0; i < grid.rows.count; i++) {
          final String value = grid.rows[i].cells[grid.columns.count - 1].value;
          total += double.parse(value);
        return total;

    Draw the table in the PDF document.

    void _drawGrid(
          PdfPage page, PdfGrid grid, PdfLayoutResult result, PdfFont contentFont) {
        Rect totalPriceCellBounds;
        Rect quantityCellBounds;
        //Invoke the beginCellLayout event.
        grid.beginCellLayout = (Object sender, PdfGridBeginCellLayoutArgs args) {
          final PdfGrid grid = sender;
          if (args.cellIndex == grid.columns.count - 1) {
            totalPriceCellBounds = args.bounds;
          } else if (args.cellIndex == grid.columns.count - 2) {
            quantityCellBounds = args.bounds;
        //Draw the PDF grid and get the result.
        result = grid.draw(
            page: page, bounds: Rect.fromLTWH(0, result.bounds.bottom + 40, 0, 0));
        //Draw grand total.'Grand Total', contentFont,
            bounds: Rect.fromLTWH(
                result.bounds.bottom + 10,
                quantityCellBounds.height));, contentFont,
            bounds: Rect.fromLTWH(
                result.bounds.bottom + 10,
  5. Include the following code to add the seller information.
    void _drawFooter(PdfPage page, Size pageSize, PdfFont contentFont) {
        final PdfPen linePen =
            PdfPen(PdfColor(142, 170, 219, 255), dashStyle: PdfDashStyle.custom);
        linePen.dashPattern = <double>[3, 3];
        //Draw line., Offset(0, pageSize.height - 100),
            Offset(pageSize.width, pageSize.height - 100));
        const String footerContent =
            '800 Interchange Blvd.\r\n\r\nSuite 2501, Austin, TX 78721\r\n\r\nAny Questions?';
        //Added 30 as a margin for the layout., contentFont,
            format: PdfStringFormat(alignment: PdfTextAlignment.right),
            bounds: Rect.fromLTWH(pageSize.width - 30, pageSize.height - 70, 0, 0));
  6. Add the assets to the pubspec.yaml file.
    # To add assets to your application, add an assets section, like this.
      - assets/Roboto-Regular.ttf
  7. Include the following code to read the font data from the folder where it is saved. Here, we have named our folder assets.
    Future<List<int>> _readData(String name) async {
    final ByteData data = await rootBundle.load('assets/$name');
    return data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);

    By executing the code example, the PDF/A-1B conformance document will be created like in the following screenshot.
    Create PDF/A-1B conformance document

Boost your productivity with Syncfusion's PDF Library! Gain access to invaluable insights and tutorials in our extensive documentation.

Create PDF/A-2B file

Just modify the PdfConformanceLevel to a2b during the PdfDocument object initialization to create a PDF document with the PDF/A-2B conformance level. The following code illustrates this.

//Create a new PDF document with conformance A2B.
PdfDocument document =
    PdfDocument(conformanceLevel: PdfConformanceLevel.a2b);

By executing the previous code, a PDF document with PDF/A-2B conformance level will be created.
Create PDF/A- 2B conformance document

See a world of document processing possibilities in Syncfusion's PDF Library as we unveil its features in interactive demonstrations.

Create PDF/A-3B file

PDF/A-3B conformance supports attachments to the PDF document. Modify the PdfConformanceLevel to a3b during the PdfDocument object initialization to create a PDF document with a PDF/A-3B conformance level. The following code illustrates this along with including an attachment to the PDF document.

//Create a new PDF document with conformance A3B.
PdfDocument document =
    PdfDocument(conformanceLevel: PdfConformanceLevel.a3b);
//Add attachment to the PDF document.
String text =
    'Adventure Works Cycles, the fictitious company on which ...';
    'AdventureCycle.txt', utf8.encode(text),
    description: 'Adventure Works Cycles', mimeType: 'application/txt'));

By executing this code, you will get an output PDF document like the following screenshots.
Create PDF/A -3B conformance document

PDF/A-3B file with attachmentResource

You can check out the complete sample in this GitHub repository to create PDF conformance documents.

Join thousands of developers who rely on Syncfusion for their PDF needs. Experience the difference today!


In this blog post, we have learned the procedure to create PDF documents at various conformance levels using our Syncfusion PDF Flutter Library.

Take a moment to peruse our documentation, where you’ll find other options and features, all with accompanying code examples.

If you have any questions about these features, please let us know in the comments below. You can also contact us through our support forum, Direct-Trac, or feedback portal. We are happy to assist you!

If you liked this article, we think you would also like the following articles about PDF Library:


Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed