none
Cycle through files using itextsharp RRS feed

  • Question

  • Hello,

    I want to use itextsharp to cycle through many files (within powershell) but can't seem to find any info on it either on the powershell side or the itextsharp side.  Any ideas?

    I apologize if this is not the place to be asking.

    Thanks,

    Bernard

    Thursday, October 1, 2015 4:12 PM

Answers

All replies

  • Hi,

    Many references here for how to use iTextSharp with PowerShell:

    https://duckduckgo.com/?q=powershell+itextsharp&ia=qa

    To 'cycle' you'd just use Get-ChildItem to get the files, pass them into a ForEach-Object loop, and then do whatever iTextSharp magic you want on each file inside the loop.


    Thursday, October 1, 2015 4:20 PM
  • Hi Mike,

    I appreciate you prompt response.  It's really the itextsharp part I'm having a problem with, I have:

    itextsharp.text.pdf.PdfReader($file), it doesn't like the $file. If I have one particular file it's fine.  So far I haven't been able to locate much in terms of itextsharp documentation.

    Thanks,

    Bernard

    Thursday, October 1, 2015 5:44 PM
  • File has to have a value.  How are you assigning its value?


    \_(ツ)_/

    Thursday, October 1, 2015 5:50 PM
  • Hello,

    It's basically:

    $containerFile = get-childitem . -include *.pdf -recurse

    foreach ($file in $containerFile) {

    Thanks,

    Bernard

    Thursday, October 1, 2015 5:54 PM
  • You might need to use $file.FullName.

    • Marked as answer by moleculez Thursday, October 1, 2015 6:08 PM
    Thursday, October 1, 2015 5:55 PM
  • Hi Mike,

    That was it!

    Thanks,

    Bernard

    Thursday, October 1, 2015 6:08 PM
  • Cheers Bernard, you're very welcome.

    Thursday, October 1, 2015 6:11 PM