PHP Classes

PHP PDF Generator from XML: Generate PDF documents from XML templates

Recommend this page to a friend!
  Info   View files Example   View files View files (22)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 431 All time: 6,312 This week: 74Up
Version License PHP version Categories
xml-to-pdf 1.0.0The PHP License5XML, PHP 5, Files and Folders, Printing, C..., T...
Description 

Author

This package can generate PDF documents from XML templates.

It can take as parameters a XML file with the definition of reports and some template values.

The class can generate a PDF document using the FPDF library

Picture of Simone Gosetto
  Performance   Level  
Name: Simone Gosetto <contact>
Classes: 2 packages by
Country: Italy Italy
Age: 33
All time rank: 3239124 in Italy Italy
Week rank: 234 Up9 in Italy Italy Up

Recommendations

generate pdf with php
i need to generate a pdf from php and mysql

Generate Report
I need a php class that will output a pdf or excel document r

Example

<?php

/*
    TABLE EMEDDED APPROACH
*/

/*
$array = array(
    "template" => addslashes("template.xml"),
    "data_object" => array('title' => 'Example Title',
                        'author' => 'Simone Gosetto',
                        'process' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pellentesque ante vel odio blandit, at bibendum turpis fermentum. Nunc auctor sagittis lectus et tincidunt. In feugiat a odio id blandit. Praesent lacinia in est a aliquam. Nunc massa nibh, facilisis sed venenatis a, ullamcorper non risus. Curabitur dignissim odio id gravida rutrum. Donec a urna a erat sodales facilisis. Fusce tristique pharetra mi quis sodales. Etiam rutrum sit amet purus sit amet convallis. Nam nunc purus, aliquet eget massa sit amet, feugiat congue nibh. Duis consequat lorem a porttitor viverra. Sed a dolor et urna laoreet aliquam nec quis justo. Duis sollicitudin varius scelerisque. Nullam aliquet libero et dapibus cursus. Ut porta elementum maximus. Curabitur eget est ac eros convallis viverra id a massa.',
                        'image' => 'https://www.google.it/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png',
                        'table_embedded' => array(
                            array("name" => "farina", "quantity" => 100, "perc" => 30),
                            array("name" => "olio", "quantity" => 70, "perc" => 20)
                        )
                    )
);

$param = json_encode($array);
Header("Location: SG_ReportService.php?ReportData=".$param);


*/


/*
    TABLE GLOABL APPROACH
*/

/*

$array = array(
    "template" => "template_2.xml",
    "data_object" => array(
                        array(
                            'title' => 'Example Title',
                            'author' => 'Simone Gosetto',
                            'process' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pellentesque ante vel odio blandit, at bibendum turpis fermentum. Nunc auctor sagittis lectus et tincidunt. In feugiat a odio id blandit. Praesent lacinia in est a aliquam. Nunc massa nibh, facilisis sed venenatis a, ullamcorper non risus. Curabitur dignissim odio id gravida rutrum. Donec a urna a erat sodales facilisis. Fusce tristique pharetra mi quis sodales. Etiam rutrum sit amet purus sit amet convallis. Nam nunc purus, aliquet eget massa sit amet, feugiat congue nibh. Duis consequat lorem a porttitor viverra. Sed a dolor et urna laoreet aliquam nec quis justo. Duis sollicitudin varius scelerisque. Nullam aliquet libero et dapibus cursus. Ut porta elementum maximus. Curabitur eget est ac eros convallis viverra id a massa.',
                            'image' => 'https://www.google.it/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png',
                            'name' => 'farina',
                            'quantity' => 100,
                            'perc' => 30
                        ),
                        array(
                            'title' => 'Example Title',
                            'author' => 'Simone Gosetto',
                            'process' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pellentesque ante vel odio blandit, at bibendum turpis fermentum. Nunc auctor sagittis lectus et tincidunt. In feugiat a odio id blandit. Praesent lacinia in est a aliquam. Nunc massa nibh, facilisis sed venenatis a, ullamcorper non risus. Curabitur dignissim odio id gravida rutrum. Donec a urna a erat sodales facilisis. Fusce tristique pharetra mi quis sodales. Etiam rutrum sit amet purus sit amet convallis. Nam nunc purus, aliquet eget massa sit amet, feugiat congue nibh. Duis consequat lorem a porttitor viverra. Sed a dolor et urna laoreet aliquam nec quis justo. Duis sollicitudin varius scelerisque. Nullam aliquet libero et dapibus cursus. Ut porta elementum maximus. Curabitur eget est ac eros convallis viverra id a massa.',
                            'image' => 'https://www.google.it/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png',
                            'name' => 'olio',
                            'quantity' => 70,
                            'perc' => 20
                        ),
                    )
);

$param = json_encode($array);
Header("Location: SG_ReportService.php?ReportData=".$param);

*/


Details

I've thought to realize an XML interpreter that by FPDF library can create a Report PDF. This system is very customizable and flexible. I HAVE DONE ALL MY TESTS WITH PC WWINDOWS 7/10 WITH XAMPP AND PHP 7.2.3 EXAMPLES: Into the file ?example.php? you find any examples of code

  Files folder image Files  
File Role Description
Files folder imagefpdf_v1-81 (1 file, 1 directory)
Accessible without login Plain text file example.php Example example
Accessible without login Plain text file LICENSE Doc. licence
Accessible without login Plain text file readme_EN.md Doc. readme en
Accessible without login Plain text file readme_IT.md Doc. readme it
Plain text file SG_ReportEnum.php Class enum
Plain text file SG_ReportService.php Class service
Accessible without login Plain text file template.xml Data template 1
Accessible without login Plain text file template_2.xml Data template 2

  Files folder image Files  /  fpdf_v1-81  
File Role Description
Files folder imagefont (13 files)
  Accessible without login Plain text file fpdf.php Appl. library folder

  Files folder image Files  /  fpdf_v1-81  /  font  
File Role Description
  Accessible without login Plain text file courier.php Conf. font courier
  Accessible without login Plain text file courierb.php Conf. font
  Accessible without login Plain text file courieri.php Conf. font
  Accessible without login Plain text file helvetica.php Conf. font
  Accessible without login Plain text file helveticab.php Conf. font
  Accessible without login Plain text file helveticabi.php Conf. font
  Accessible without login Plain text file helveticai.php Conf. font
  Accessible without login Plain text file symbol.php Conf. font
  Accessible without login Plain text file times.php Conf. font
  Accessible without login Plain text file timesb.php Conf. font
  Accessible without login Plain text file timesbi.php Conf. font
  Accessible without login Plain text file timesi.php Conf. font
  Accessible without login Plain text file zapfdingbats.php Conf. font

 Version Control Unique User Downloads Download Rankings  
 0%
Total:431
This week:0
All time:6,312
This week:74Up