A NEW TECHNIQUE for CREATING PDF REPORTS USING TCPDF Kavitha D.M1, Mrs Bharathi M2, 1PG Student IV Sem Mtech, S.J.C
Total Page:16
File Type:pdf, Size:1020Kb
A NEW TECHNIQUE FOR CREATING PDF REPORTS USING TCPDF Kavitha D.M1, Mrs Bharathi M2, 1PG Student IV sem MTech, S.J.C. Institute of Technology, Chickaballapur, Karnataka (India) 2PHD Research Scholar, MSRIT College of Engineering, Bangalore, Karnataka (India) ABSTRACT Reporting module is a generic template developed for creating PDF reports. This has been developed using TCPDF as part of the Drupal, PHP and Apache environment. TCPDF is a free and open source php class for generating reports in PDF format.TCPDF is a PHP based library that includes complete support for utf-8 unicode and right to left languages. This module has been created to take in parameters including but not restricted to Header information, Footer Details and main body or the report content. SIFI provides various modules like Master Data Management, which includes banks, loans, user data management, bill of materials(BOM) and payments. Log management, back up and recovery importing Excel files, and analysis. Reporting module that includes generate pdf files and save file functionalities. Each page can generate a pdf file with the help of TCPDF, it is easy to change logo of any file and the details. This module supports image in the report in the form of jpg, png and svg images. SIFI is a web based application, built on Ubuntu which acts as operating system, Apache Web Server for hosting web sites, Drupal for Content Management and MySql as the backend data store. Drupal modules are been developed using PHP for all the functionalities. Keywords: TCPDF, Drupal, Generate pdf reports, Save files. I. INTRODUCTION TO TCPDF AND ITS INSTALLATION TCPDF is a free and open source php class for generating reports in PDF format. [1] TCPDF is a PHP based library that includes complete support for utf-8 unicode and right to left languages. TCPDF is one of the most active over 200000 projects hosted on the sourceforge repository. TCPDF is one of the most used php libraries it included in the most popular php based applications including drupal, phpMyAdmin, TCExam, Xoops, Yii Framework CMS and many others. Html2pdfPHP script by Laurent Minguet is based on TCPDF v5.0.002. This library allows generating PDF documents specified via a subset of html without learning underlying TCPDF. TCPDF was originally derived in 2002 from the public domain FPDF class written by Olivier plathey but now has been almost entirely rewritten and hundreds of new features added[2]. TCPDF is free and open source software to generate pdf reports.[3] Download the latest stable release version tcpdf_6_2_11.zip format. Unzip the distribution file into a directory under your web server root. Create new folder in var/www/html/testpdf path and name “tcpdf”. Extract the files over there. After extracting you will get all the config files and examples. Once the installation is done change the TCPDF directory and enter the following system command chown -R apache. Change the files access permission so that all user can write into the them. On POSIX based systems change to the TCPDF directory and enter the following system command: chmod -R 777. For security reasons, set as read-only the entire TCPDF folder (chmod -R 644 in POSIX systems), properly set the write permissions for the following folders where TCPDF will have to write 85 | P a g e (chmod -R 666 in POSIX systems). Then go back to the web browser http://localhos/tcpdf/exampe_001 you will receive a pdf file. 1.1 Features includes: There is no need of external libraries are required for the basic functions All standard page formats, custom page formats, custom margins and units of measure used It uses UTF-8 Unicode and Right-To-Left languages The unicodes are TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts Font subsetting Methods to publish some XHTML code, Javascript and Forms Images, graphic (geometric figures) and transformation methods 1D and 2D barcodes including QR-Code, Datamatrix and PDF417 Automatic page header and footer management Document encryption up to 256 bit and digital signature certifications Transactions to UNDO commands PDF annotations, including links, text and file attachments Text rendering modes (fill, stroke and clipping) Multiple columns mode No-write page regions Bookmarks and table of content Text hyphenation Text stretching and spacing (kerning) Automatic page break, line break and text alignments including justification Automatic page numbering and page groups Move and delete pages Page compression XObject Templates PDF/A-1b (ISO 19005-1:2005) support II. REPORTING MODULE In the reporting module that basically used from TCPDF where the tcpdf is a free and open source php class for generating reports in PDF format. TCPDF is a PHP based library that includes complete support for utf-8 unicode and right to left languages. The UTF-8 is a character encoding capable of encoding all possible characters in Unicode. This module has been created to take in parameters including but not restricted to Header information, Footer details and main body or the report content. 86 | P a g e Fig 1: shows how pdf works using tcpdf. The reporting module that contains three cases Header, footer and the main body. Using the tcpdf in report easy to change the header which we have developed pdf with title and any details. In the header we can also add logo or the image of particular pdf. If we take any company report or the college that contains their own logo so it is easy to add image of particular college or company. In the footer we can add the page numbers and we can also give the company details and also we can add date format. In the third case we use main body that can include any information of company, banks or the colleges. In these three cases we can change and add the information only in the tcpdf as in the normal pdf we can’t edit any information. Using TCPDF in drupal to create reporting module is easy to generate pdf and it is used to save the file then we can take a print of that generated pdf. The reporting module contains all the modules which are mentioned in the abstract. Each module contains sub modules with the personal details and some other details, when we require particular details of any module can easily generate a pdf file with the details of module and saves the file. As shown in fig 1 the working of the pdf file using tcpdf. The tcpdf file contains the examples with details and those examples are in php code. With the help of examples we can change the code to get our own pdf with the logo and details. It is easy to change any details in tcpdf with the php code to obtain a own pdf. For example we consider, The sifi application includes many modules, we consider bank, the bank contains number of employee records when we require a particular employee details to create pdf file with particular page using tcpdf is easy to add the logo and details n the header(bank image and bank address) and in main body that includes details of employee name, age, date of joining, salary, employee id and address. In the footer includes name of the bank, date format and page numbers. The particular page can be easily generate a pdf and saves the files with the image and details in the header. 2.1 Advantages: Time consumption: Easy to create pdf file with adding image and details then saving of file. Flexible: We can change or modify the contents. Scalable: This used in any organization where lack of records are stored. III. TECHNOLOGY USED SIFI is a web based application, built on Ubuntu which acts as operating system, it is used in well-known organizations, including corporations, companies, governments, schools, banks, hospitals, post offices, education sectors for storing data for long time. 87 | P a g e 3.1 Drupal The name Drupal represents an English convertion of the Dutch word "druppel", which means "drop" (as a water droplet). [5]The name came from Drop.org Web site, whose code slowly evolved into Drupal. Buytaert wanted to call the site "dorp" (Dutch for "village") for its residential/religious aspects, but he miss typed when it was published ,then they started to search for better name where fortunately Drupal sounded better when checking the domain name. Basically drupal got a significant boost in 2003 when it helped build "Dean Space" for Howard Dean. Dean used drupal as open source sharing (means he made available with cost effective/user friendly).[ 6] Drupal is a content management system, means it is a application which allows the authenticated user to insert, delete or modify data. Download the drupal recent version in tar.gr format. Create a new folder in /var/www/html path and name the folder name as “site finance”. Extract the files over there. After extracting you will get some default files and owner permissions should be changed for all files to read and write. Once you are done with this go to web browser and type in url browser HTTP://localhost/sitefinance so that the front page of drupal’s site finance exists. And go to roles and permission and create new user and give the permission. This new user is needed, because every user who is member of drupal should not have administrator permission .Each time when some change is performed you need to go to configuration and select performance and there the option called clear cache exists. Once has been done with all these the drupal is now ready to use.