我有Adobe LiveCycle PDf inf webPage。它有6页。很少有细节会从数据库中自动获取。我必须输入一些细节,然后单击“提交”。使用Selenium,这是不可能的。任何人都可以建议我通过Java / Javascript之类的编程/脚本来实现这个目标吗?
答案 0 :(得分:0)
第一个策略:使用Native LiveCycle API(需要访问LiveCycle基础架构) 根据您的LiveCycle版本,您将能够执行此操作。
您的PDF必须是生活周期的pdf,由生活方式设计师制作。 我建议您使用pdf和设计器测试您的数据。
Adobe LiveCycle Documentation for 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不再支持它了。
然后使用Designer,您可以在pdf中插入javascript代码,以便生成日志或直接Web服务代码。
第二个策略:使用Sikuli的硒变异
您似乎可以使用selenium等第三方工具编写填充流程,但您说selenium不能为您提供pdf交互。
所以我建议你使用 Sikuli http://www.sikuli.org/ 此工具可以让您编写任何可视交互的脚本。
请记住,您必须处理PDF格式识别区域和屏幕分辨率......