问题
I have pdf file that contains some text that I want to replace with another piece of text (and save the file with new name.)
Can I do that with iTextSharp?
And how?
Can you give me guide for it?
回答1:
Generally speaking this is not possible. Check out this FAQ question which discusses the issue. The FAQ addresses iText (the Java version project from which iTextSharp was derived) but applies to iTextSharp as well.
Keep in mind the comments on the (linked) example:
/* This is only a partial answer. It's a quick and dirty method showing how to
* change a stream inside a PDF. Obviously, you'll have to detect words that are
* stored in Form XObjects too, and you can seriously screw up the layout when
* you manipulate the content stream as is done in this example.
*/
来源:https://stackoverflow.com/questions/958478/save-pdf-template-file-to-new-pdf-file-after-edit-text-in-asp-net