【发布时间】:2018-08-04 07:02:46
【问题描述】:
我有 Adobe LiveCycle PDf inf 网页。它有 6 页。很少有细节会自动从数据库中获取。我必须输入一些详细信息,然后单击提交。使用 Selenium,这是不可能的。谁能建议我通过 Java/Javascript 之类的编程/脚本来实现这一点?
【问题讨论】:
标签: javascript java adobe
我有 Adobe LiveCycle PDf inf 网页。它有 6 页。很少有细节会自动从数据库中获取。我必须输入一些详细信息,然后单击提交。使用 Selenium,这是不可能的。谁能建议我通过 Java/Javascript 之类的编程/脚本来实现这一点?
【问题讨论】:
标签: javascript java adobe
第一个策略:使用原生 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 可以实现这一点,但 Adobe 似乎不再支持它了。
然后使用设计器,您可以在 pdf 中插入 javascript 代码以生成日志或直接生成 Web 服务代码。
第二个策略:使用 Sikuli 的 Selenium 变化
您似乎可以使用 selenium 等第三方工具编写脚本填充过程,但您是说 selenium 不提供对 pdf 交互的访问权限。
所以我建议你使用 Sikuli http://www.sikuli.org/ 这个工具可以让你编写任何视觉交互的脚本。
请记住,您必须处理 pdf 识别区域和屏幕分辨率...
【讨论】: