Hello,
I seem to be having an issue using the ContentReplacer. The text to be replaced is never changed and the replacing text is put in the middle of the page. Also when replacing text, all images are removed in the saved document. I am using PDFNet 6.0.1.0
This is my method:
PDFNet.Initialize();
string fileIn1 = @“C:\LetterIn4.pdf”;
string fileOut = @“C:\LetterOut.pdf”;
try {
PDFDoc doc = new PDFDoc(fileIn1);
doc.InitSecurityHandler();
ContentReplacer replacer = new ContentReplacer();
Page page = doc.GetPage(1);
//replace the text place holders
replacer.AddString(“FIRSTNAME”, “William”);
// finally, apply
replacer.Process(page);
doc.Save(fileOut, 0);
doc.Close();
}
catch (PDFNetException e) {
throw new NotImplementedException(e.Message);
}
The attached file: LetterIn4.pdf is my input document and
LetterOut.pdf is the resulting document.
Any ideas?
LetterIn4.pdf (71.6 KB)
LetterOut.pdf (110 KB)