Tutorial on perl pdf


















Set the font size with prFontSize. The default font is Helvetica, with 12 pixel size. The rest of the code is a simple loop over the file containing the customer data to filling the template with prText. If you know low-level PDF instructions, you can add them with with the prAdd string subroutine. Working with PDF files becomes comfortable if the document has bookmarks with a table of contents-like structure.

The command-line application will interact with this package instead of directly working on PDF::Reuse. The following diagram shows the relationship between the Packages, example, and applications. The application app-combine-console-pdfs.

This is the standard package for this task. Here it parses the input filenames and the page ranges into two arrays of same length. The user also has to supply a filename for the output and, optionally, a bookmarks file. If the user passes an insufficient number of arguments, invalid filenames, or incorrect page ranges, the code invokes the the usage subroutine. It also gets invoked if the user asks explicitly for -help on the command line.

Any good command line application should be written that way. It can store these arguments as arrays infile, pages , hashes, or scalars.

It also supports type checking. The application itself mainly performs error checking. If everything is fine, it calls the CombinePDFs::createPDF subroutine, passing the array of input files, the array of page ranges, and the bookmarks information.

The bookmarks scalar is optional. Page ranges can be comma-separated ranges ,14, , single pages, or the all token.

You can include the same page several times in the same document. Although PDF , by Antonio Rosella, also provides such a method, this package was not developed with the use strict pragma and gives a lot of warnings. Furthermore, the package is not actively maintained, so there seems to be no chance to fix this in the near future. Please note that PDF::Reuse is not an object oriented package. Therefore the CombinePDFs package is not object oriented, either. A user of this package could create several instances, but all instances work on the same PDF file.

Submitting complex data structures via the command line is a difficult issue, so I decided that bookmarks should come from a text file. This file has a simple markup to reflect a tree structure, where each line resembles:. Section 3. List — introduces you to the list and how to manipulate list elements. Array — learns about arrays and how to manipulate arrays effectively. Hash — guides you on another compound data type called hash and shows you how to manipulate hash elements effectively.

Section 4. Section 5. Perl Regular Expression Regular expressions allow you to match text based on patterns. Section 6. References — introduces you to references. Reference types and autovification — guides you on the reference types and autovification. Section 7. Subroutines A large Perl program is divided into reusable units of code which are known as functions or subroutines.

Subroutines — learns how to organize large code into more manageable units called subroutines. Pass parameters to subroutines by reference and value — shows you how to pass parameters to subroutines by reference and by value. Code Examples tar. Buy This Book: Amazon. Perl is a well-established programming language that has been developed through the time and effort of countless free software programmers into an immensely powerful tool that can be used on pratically every operating system in the world.

Perl started out as the "Swiss army knife" of computer languages and was used primarily by system administrators, but over time it's grown into an immensely robust language used by web-developers and programmers worldwide.

It's also a great way to learn programming techniques and develop your own style of coding.



0コメント

  • 1000 / 1000