【问题标题】:Can we fill data in Adobe livecyle pdf which is embedded in PDF Using Java?我们可以使用 Java 在嵌入在 PDF 中的 Adob​​e livecycle pdf 中填充数据吗?
【发布时间】:2018-08-04 07:02:46
【问题描述】:

我有 Adob​​e LiveCycle PDf inf 网页。它有 6 页。很少有细节会自动从数据库中获取。我必须输入一些详细信息,然后单击提交。使用 Selenium,这是不可能的。谁能建议我通过 Java/Javascript 之类的编程/脚本来实现这一点?

【问题讨论】:

    标签: javascript java adobe


    【解决方案1】:

    第一个策略:使用原生 LiveCycle API(需要访问 LiveCycle 基础架构) 根据您的 LiveCycle 版本,您将能够执行此操作。

    您的 PDF 必须是由生活方式设计师制作的生命周期 pdf。 我建议您使用 pdf 和设计器测试您的数据。

    Adobe LiveCycle 10.1 版本的文档在这里解释了如何实现这一点:https://help.adobe.com/en_US/livecycle/10.0/ProgramLC/WS624e3cba99b79e12e69a9941333732bac8-7de6.html

        * This Java Quick Start uses the EJB model and contains the following JAR files 
    * in the classpath: 
    * 1. adobe-for data integration-client.jar 
    * 2. adobe-lifecycle-client.jar 
    * 3. adobe-user-manager-client.jar 
    * 4. adobe-utilities.jar 
    * 5. jbossall-client.jar (use a different JAR file if the LiveCycle Server is not deployed 
    * on JBoss) 
    * 6. jacorb.jar (use a different JAR file if the LiveCycle Server is not deployed on JBoss) 
    * 7. jnp-client.jar (use a different JAR file if the LiveCycle Server is not deployed on JBoss) 
    
     //Create a ServiceClientFactory object 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
    
            //Create a FormDataIntegrationClient object 
            FormDataIntegrationClient dataClient = new FormDataIntegrationClient(myFactory);  
    
            //Import XDP XML data into an XFA PDF document 
            //Reference an XFA PDF form 
            FileInputStream inputStream = new FileInputStream("C:\\Adobe\Loan.pdf");  
            Document inputPDF = new Document(inputStream);  
    
            FileInputStream dataInput = new FileInputStream("C:\\Adobe\Loan_data.xml");  
            Document inputDataFile = new Document(dataInput);  
    
            //Import data into the form 
            Document resultPDF = dataClient.importData(inputPDF,inputDataFile); 
    
            //Save the PDF file 
            File resultFile = new File("C:\\Adobe\ResultLoanForm.pdf");  
            resultPDF.copyToFile(resultFile);
    

    在旧版本中,有一个独立的 API 可以实现这一点,但 Adob​​e 似乎不再支持它了。

    然后使用设计器,您可以在 pdf 中插入 javascript 代码以生成日志或直接生成 Web 服务代码。

    第二个策略:使用 Sikuli 的 Selenium 变化

    您似乎可以使用 selenium 等第三方工具编写脚本填充过程,但您是说 selenium 不提供对 pdf 交互的访问权限。

    所以我建议你使用 Sikuli http://www.sikuli.org/ 这个工具可以让你编写任何视觉交互的脚本。

    请记住,您必须处理 pdf 识别区域和屏幕分辨率...

    【讨论】:

    • 与sikuli相关,如何区分两个相同但只有标签不同的输入
    • 不确定您要的是什么...如果标签不同但“静态”(在多个 pdf 中没有不同),sikuli 允许您通过图片/外观获取它们
    • 看起来 adobe 处理存储在本地而不是网页中的 PDF?因为我的情况是我在本地没有 PDF,它是作为网页嵌入的
    • 是的。这就是为什么我之前写的那种方式意味着访问 adobe 基础架构
    猜你喜欢
    • 1970-01-01
    • 2011-01-18
    • 2015-08-10
    • 1970-01-01
    • 2010-10-04
    • 2012-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多