使用.net在pdf中编辑javascript [英] Editing javascript in a pdf with .net

查看:121
本文介绍了使用.net在pdf中编辑javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用.net编辑pdf文档的javascript?

Is it possible to edit the javascript of a pdf document with .net?

我查看了 Acrobat SDK ,但是运气不佳.看起来您可以从表单等中检索值,但不能编辑文档.

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?

我已经尝试过 iTextSharp ,但是由于pdf包含表单字段,因此当我保存了pdf.

I've tried iTextSharp, but since the pdf contains form fields, the fields are lost when I save the pdf.

有什么建议吗?

推荐答案

好吧,显然您可以使用 iTextSharp :

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();

((该问题有所帮助)

这篇关于使用.net在pdf中编辑javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆