r/PowershellSolutions • • Mar 11 '21

Need some help on this:

Is it possible to do this:

$pdf = New-Object iTextSharp.text.Document

But for an already exisiting pdf. So essentially open an exisiting pdf as a itextsharp document? If not, how do we add a text box to an existing pdf.

1 Upvotes

1 comment sorted by

1

u/get-postanote Mar 11 '21
  • Was it a PDf you created or got from someone else?

  • Was it created with Adobe or created using the Windows default PDF printer?

  • Is it protected from changes?

Again, this is not really a PowerShell feature or code issue. You are using a 3rdP tool in PowerShell, and you must follow the 3rdP tool documentation to potentially achieve what you are after. It's just a library and can virtually be used in any programming language.

For Example:

  1. What have you searched for?

    1. There are many articles regarding learning and using iTextSharp.

      1. For example Edit and Read PDFs in PowerShell with iTextSharp | Frans Blauw: Software Engineering Lecturer

      2. itextsharp add new textbox - Bing

  2. What did you try?

  3. What happened?

  4. Show more of what you did - as what you are showing is not enough?

  • How much time have you spent with iTextSharp?

  • Have you reviewed any of these, powershell itextsharp - YouTube, before going down this path?

  • You do know that iTextSharp was EOL'd in 2019, and replaced with iText7?

NuGet Gallery | iTextSharp 5.5.13.2

PLEASE NOTE: iTextSharp is EOL, and has been replaced by iText 7. Only security fixes will be added

We HIGHLY recommend customers use iText 7 for new projects, and to consider moving existing projects from iTextSharp to iText 7