我怎样才能将数据合并到一个XDP文件,并返回一个PDF(通过.NET)? [英] How can I merge data into an XDP file and return a PDF (via .NET)?

查看:243
本文介绍了我怎样才能将数据合并到一个XDP文件,并返回一个PDF(通过.NET)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队,我们使用Adobe LiveCycle Designer中创建了一个模板(XDP)。

My team has a template (XDP) that we've created with the Adobe LiveCycle designer.

情况:

  • 我们正在更换旧的Acrobat表单 (XFDF格式)本的LiveCycle 形式的一个更大的升级的一部分

  • We are replacing an old Acrobat form (XFDF format) with this LiveCycle form as part of a much larger upgrade

目前的Acrobat形式 动态填充基本数据 并传递给用户作为PDF (用户点击一个链接,一个PDF 打开自己的机pre-人口 与基本的人口统计信息)

The current Acrobat form is dynamically populated with basic data and delivered to the user as a PDF (the user clicks a link and a PDF opens on their machine pre-populated with basic demographic details)

当前进程看起来是这样的:用户点击,.NET应用程序检索数据,.NET应用程序检索的PDF从文件系统,.NET应用程序序列化的数据到模板中XFDF形式,ASP.NET应用程序发送一个HTTP响应返回到XFDF格式的用户,用户查看PDF在Adobe Reader

The current process looks something like: user clicks, .NET app retrieves data, .NET app retrieves PDF from file system, .NET app serializes data into template in XFDF form, ASP.NET app sends an HTTP response back to the user in XFDF format, the user views the PDF in Adobe Reader

我们想保持一个大致类似的方法与新的XDP格式。

We would like to maintain a roughly analogous process with the new XDP format.

有关的记录,我们的不要的访问到的LiveCycle服务,做这种类型的工作(如渲染服务)。这就是说,我们要创建这种类型的序列化的.NET中的几个原因:。我们只有有限的LiveCycle许可证和将很难访问的LiveCycle服务,由于在企业中的位置

For the record, we DO have access to the LiveCycle services that do this type of work (e.g. the Render service). That said, we would like to create this type of serialization in .NET for a few reasons: we have limited LiveCycle licenses and will struggle to access the LiveCycle services due to their location in the enterprise.

有什么想法(甚至停止这样做,你是疯了)的AP preciated。

Any thoughts (even "stop doing that, you're insane") are appreciated.

推荐答案

哎,对不起缓慢回复,并没有看到这一点。

Hey, sorry for the slow reply, didn't see this.

创建PDF文件。恩code这为base64。

Create the PDF. Encode it as base64.

创建一个文本文件,foo.xdp:

Create a text file, foo.xdp:

<?xml version='1.0' encoding='UTF-8'?>
<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>
<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>
    <xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>
        <xfa:data>

将这里的XML这是你的动态数据,在PDF格式相匹配的动态字段。

Insert the XML here that is your dynamic data, matching the dynamic fields in the PDF.

        </xfa:data>
    </xfa:datasets>
    <pdf xmlns=\"http://ns.adobe.com/xdp/pdf/\"><document>
       <chunk>

没有把任何字符的标签之后,插入的base64 EN codeD上的PDF。

Without putting any characters after the tag, insert the base64 encoded PDF.

        </chunk>
    </document></pdf>
</xdp:xdp>

和,你瞧,你有一个有效的XDP。 Adobe Reader的会接受这一点,并显示PDF在它自己的价值观。

And, lo and behold, you have a valid XDP. Adobe Reader will accept this and display the PDF with your values in it.

在Java中,如果你有一个性能与它连接的详细信息,下面的code可以使用ActionScript 3.0语言转向的XDP到PDF,虽然可能会因人而异在C#。

In Java, if you have a Properties with the connection details in it, the following code can use Livecycle to turn an XDP to a PDF, although your mileage might vary in C#.

        // Create a ServiceClientFactory object
        ServiceClientFactory myFactory = ServiceClientFactory
                .createInstance(connectionProperties);

        // Create a PDF Utility client
        PDFUtilityServiceClient pdfClient = new PDFUtilityServiceClient(myFactory);

        // Specify an XDP file to convert to a PDF document
        ByteArrayInputStream bais = new ByteArrayInputStream(xdp.getBytes("ASCII"));
        Document inDoc = new Document(bais);

        // Convert the XDP file to a PDF document
        Document pdf = pdfClient.convertXDPtoPDF(inDoc);

        // Return the PDF as an InputStream.
        return pdf.getInputStream();

这篇关于我怎样才能将数据合并到一个XDP文件,并返回一个PDF(通过.NET)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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