PDF hacks with Microsoft PowerShell and iText

[ad_1]

PDF files are actually not intended for subsequent changes: they should reflect the layout that the creator wants. Nevertheless, it can happen that you have to insert pictures afterwards or combine several PDFs into one. If you only want to manipulate a single PDF document, graphic PDF editors are available. However, if you have to edit a whole series of such files, there are better solutions that do this task quickly using automation in the command line.

Program libraries such as the free iText come with extensive tools that can be used to create and manipulate PDF files. The iText 5 library is also available in Java as the iTextSharp C # port. This makes it easy to integrate into PowerShell scripts, since PowerShell, like C #, is based on .NET and can handle such libraries. The program library is dual licensed, once proprietary and once under the Affero General Public License (AGPL). It enables programs and scripts for administration to be expanded quickly with dynamic PDF solutions. As free-to-use software, many applications and web services already contain iText to create PDF files. They use it to generate invoices in web shops and create digital tickets. Exciting for private use: iText can also add digital signatures to a document, split or chain PDF documents and much more.

In this article we give an overview of what you can do with PDFs in PowerShell. We compile a first “Hello World” example and explain the basics of PDF creation with iTextSharp. Since the current development of the tool takes place in iText 7, let’s take a look at the successor and briefly explain to what extent the work differs between the two versions.

  • Access to all heise + content
  • exclusive tests, guides & backgrounds: independent, critically sound
  • Read c’t, iX, Technology Review, Mac & i, Make, c’t photography directly in the browser
  • Register once – read on all devices – cancel monthly
  • first month free, then monthly € 9.95
  • Weekly newsletter with personal reading recommendations from the editor-in-chief

Start FREE month

Start FREE month now
already subscribed to heise +?

Sign up and read

Register now and read the article immediately
More information about heise +

To home page

[ad_2]

Leave a Reply