Is it possible to edit the javascript of a pdf document with .net?
I've looked at the Acrobat SDK, but without much luck. It looks like you can retrieve values from forms etc. but not edit the document.
Am I way off track? Is this even possible?
I've tried iTextSharp, but since the pdf contains form fields, the fields are lost when I save the pdf.
Any suggestions?
Well, apparently you can with iTextSharp:
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
PdfReader reader = new PdfReader(@"Source.pdf");
FileStream output = new FileStream(@"Destination.pdf", FileMode.Create);
PdfStamper pdfStamper = new PdfStamper(reader, output, '\0', true);
pdfStamper.JavaScript = "app.alert(\"Hello world!\");";
pdfStamper.FormFlattening = false;
pdfStamper.Close();
reader.Close();
(This question helped)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With