Search code examples
c#itextitext7

Upgradeng from iTextSharp 5.4.1.0 to itext7


I am ugrading from iTextSharp to itext7 and not seeing PdfStamper or RandomAccessFileOrArray is missing FilePath. How can I use RandomAccessFileOrArray' and what replaced pdfStamper` ?

PdfStamper pdfStamper = null;
PdfReader pdfReader = null;
PdfReader(new RandomAccessFileOrArray(FilePath,System.Text.ASCIIEncoding.UTF8.GetBytes("password")));

Solution

  • We do not have PdfStamper class in iText 7. There is only a PdfDocument class that is used for creation of files as well as for manipulation of files.

    PdfDocument pdf = new PdfDocument(new PdfReader(src), new PdfWriter(dest));