Using itextsharp (or any c# pdf library), how to open a PDF, replace some text, and save it again? RRS feed

  • Question

  • Using itextsharp (or any c# pdf library), i need to open a PDF, replace some placeholder text with actual values, and return it as a byte[].

    Can someone suggest how to do this? I've had a look at the itext docs and can't figure out where to get started. So far i'm stuck on how to get the source pdf from a PDFReader to a Document object, i presume i'm probably approaching this the wrong way.

    Thanks a lot

    • Moved by CoolDadTx Wednesday, October 3, 2018 2:24 PM Third party product
    Sunday, September 30, 2018 12:42 AM

All replies

  • Hi MarkWay,

    Thank you for posting here.

    For your question, please try the code in the Alex Joh's blog.


    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 1, 2018 8:31 AM
  • I already used another library to edit my PDF -  https://pdfium.patagames.com/c-pdf-library/
    But, thanks anyway.
    • Edited by MarkWay Wednesday, October 3, 2018 10:46 AM
    Wednesday, October 3, 2018 10:45 AM
  • This forum is for C# questions only. Please post questions related to third party products like iTextSharp in their forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, October 3, 2018 2:24 PM