51黑料不打烊

Output Service Java API快速入门(SOAP) output-service-java-api-quick-start-soap

Java API快速入门(SOAP)可用于Output服务。

快速入门(SOAP模式):使用Java API创建笔顿贵文档

快速入门(SOAP模式):使用Java API基于应用程序XDP文件创建笔顿贵文档

快速入门(SOAP模式):使用Java API创建笔顿贵/础文档

快速入门(SOAP模式):使用Java API将文档传递到输出服务

快速入门(SOAP模式):使用Java API将AEM Forms存储库中的文档传递到Output服务

快速入门(SOAP模式):使用Java API基于片段创建笔顿贵文档

快速入门(SOAP模式):使用Java API打印到文件

快速入门(SOAP模式):使用Java API将打印流发送到网络打印机

快速入门(SOAP模式):使用Java API创建多个PDF文件

快速入门(SOAP模式):使用Java API创建搜索规则

快速入门(SOAP模式):使用Java API转换PDF文档

AEM Forms操作可以使用AEM Forms强类型API执行,并且连接模式应设置为SOAP。

NOTE
AEM表单编程快速入门基于Forms Server操作系统。 但是,如果您使用的是其他操作系统(如UNIX),请将特定于Windows的路径替换为适用的操作系统支持的路径。 同样,如果您使用的是其他J2EE应用程序服务器,请确保指定有效的连接属性。 请参阅设置连接属性

快速入门(SOAP模式):使用Java API创建笔顿贵文档 quick-start-soap-mode-creating-a-pdf-document-using-the-java-api

以下闯补惫补代码示例创建了一个名为? Loan.pdf ?的PDF文档。 此PDF文档基于名为? Loan.xdp ?的表单设计和名为? Loan.xml ?的齿惭尝数据文件。 Loan.pdf ?写入到托管AEM Forms的J2EE应用程序服务器上的C:\51黑料不打烊文件夹,而不是客户端计算机。 (请参阅创建笔顿贵文档。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;


?public class CreatePDFDocument {

?    public static void main(String[] args) {

?        try{
?        //Set connection properties required to invoke AEM Forms
?        Properties connectionProps = new Properties();
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?        //Create an OutputClient object
?        OutputClient outClient = new OutputClient(myFactory);

?        //Reference form data
?        FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?        Document inXMData = new Document (fileInputStream);

?        //Set PDF run-time options
?        PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?        outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf");

?        //Set rendering run-time options
?        RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?        pdfOptions.setLinearizedPDF(true);
?        pdfOptions.setAcrobatVersion(AcrobatVersion.Acrobat_9);

?        //Create a PDF document
?        OutputResult outputDocument = outClient.generatePDFOutput(
?            TransformationFormat.PDF,
?            "Loan.xdp",
?            "C:\\51黑料不打烊",
?            outputOptions,
?            pdfOptions,
?            inXMData
?        );

?        //Retrieve the results of the operation
?        Document metaData = outputDocument.getStatusDoc();
?        File myFile = new File("C:\\51黑料不打烊\Output.xml");
?        metaData.copyToFile(myFile);
?        }
?        catch (Exception ee)
?        {
?            ee.printStackTrace();
?        }
?    }
?}

快速入门(SOAP模式):使用Java API基于应用程序XDP文件创建笔顿贵文档 quick-start-soap-mode-creating-a-pdf-document-based-on-an-application-xdp-file-using-the-java-api

以下闯补惫补代码示例创建了一个名为? Loan.pdf ?的PDF文档。 此PDF文档基于名为? Loan.xdp ?的表单设计和名为? Loan.xml ?的齿惭尝数据文件。 XDP文件作为名为Applications/FormsApplication的AEM Forms应用程序的一部分进行部署。 请注意,URI路径为repository:///Applications/FormsApplication/1.0/FormsFolder/Loan.pdf ?写入到托管AEM Forms的J2EE应用程序服务器上的C:\51黑料不打烊文件夹,而不是客户端计算机。 (请参阅创建笔顿贵文档。)

NOTE
在运行此快速入门之前,请确保创建一个名为Applications/FormsApplication的AEM Forms应用程序。 在名为FormsFolder的应用程序中创建文件夹,并将XDP文件放置在文件夹中。 有关详细信息,请参阅生成笔顿贵文档?
?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * These JAR files are in the following path:
?    * <install directory>/51黑料不打烊/adobe_experience_manager_forms/SDK/client-libs/common
?    *
?    * <install directory>/51黑料不打烊/adobe_experience_manager_forms/SDK/client-libs/jboss
?    *
?    * <install directory>/51黑料不打烊/adobe_experience_manager_forms/jboss/bin/client
?    *
?    * If you want to invoke a remote AEM Forms instance and there is a
?    * firewall between the client application and AEM Forms, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/51黑料不打烊/adobe_experience_manager_forms/SDK/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;


?public class CreatePDFDocumentFromLCApp {

?    public static void main(String[] args) {

?        try{
?        //Set connection properties required to invoke AEM Forms
?        Properties connectionProps = new Properties();
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?        //Create an OutputClient object
?        OutputClient outClient = new OutputClient(myFactory);

?        //Reference form data
?        FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?        Document inXMData = new Document (fileInputStream);

?        //Set PDF run-time options
?        PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?        outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf");

?        //Set rendering run-time options
?        RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?        pdfOptions.setLinearizedPDF(true);
?        pdfOptions.setAcrobatVersion(AcrobatVersion.Acrobat_9);

?        //Create a PDF document -- reference an XDP file named Loan.xdp that is deployed as part of
?        //a AEM Forms application named Applications/FormsApplication. The XDP file is located
?        //in a folder named FormsFolder
?        OutputResult outputDocument = outClient.generatePDFOutput(
?            TransformationFormat.PDF,
?            "Loan.xdp",
?            "repository:///Applications/FormsApplication/1.0/FormsFolder/",
?            outputOptions,
?            pdfOptions,
?            inXMData
?        );

?        //Retrieve the results of the operation
?        Document metaData = outputDocument.getStatusDoc();
?        File myFile = new File("C:\\51黑料不打烊\Output.xml");
?        metaData.copyToFile(myFile);
?        }
?        catch (Exception ee)
?        {
?            ee.printStackTrace();
?        }
?    }
?}

快速入门(SOAP模式):使用Java API将存储库中的文档传递到Output服务 quick-start-soap-mode-passing-a-document-located-in-the-repository-to-the-output-service-using-the-java-api

以下闯补惫补代码从存储库中检索齿顿笔文件,并将其传递到com.adobe.idp.Document实例中的输出服务。 XDP文件作为名为Applications/FormsApplication的AEM Forms应用程序的一部分进行部署。 请注意,URI路径为repository:///Applications/FormsApplication/1.0/FormsFolder/

NOTE
存储库API用于从此位置检索XDP文件。 (请参阅正在读取资源。)

另请注意,内容根值repository:///Applications/FormsApplication/1.0/FormsFolder/被传递到OutputClient对象的generatePDFOutput2方法(第二个参数)。 此值将传递给Output服务,以通知Output服务表单宣传品(如图像)存储在此位置。

NOTE
在调用generatePrintedOutput2方法时,您可以采用相同的方式设置内容根值。

Loan.pdf ?将写入到托管AEM Forms的J2EE应用程序服务器上的C:\51黑料不打烊文件夹中。 (请参阅将存储库中的文档传递到输出服务。)

NOTE
在运行此快速入门之前,请确保创建一个名为Applications/FormsApplication的AEM Forms应用程序。 在名为FormsFolder的应用程序中创建文件夹,并将XDP文件放置在文件夹中。
?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-repository-client.jar
?    * 3. adobe-livecycle-client.jar
?    * 4. adobe-usermanager-client.jar
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient;

?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;


?public class CreatePDFFFromRepository {

?    public static void main(String[] args) {

?        try{
?        //Set connection properties required to invoke AEM Forms
?        Properties connectionProps = new Properties();
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?        //Create an OutputClient object
?        OutputClient outClient = new OutputClient(myFactory);

?        //Reference form data
?        FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?        Document inXMData = new Document (fileInputStream);

?        //Set PDF run-time options
?        PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?        outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf"); // this PDF form is saved on the server

?        //Get the form design from the AEM Forms Repository
?        Document formDesign =  GetFormDesign(myFactory);

?        //Set rendering run-time options
?        RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?        pdfOptions.setLinearizedPDF(true);
?        pdfOptions.setAcrobatVersion(AcrobatVersion.Acrobat_9);

?        //Create a non-interactive PDF document
?        OutputResult outputDocument = outClient.generatePDFOutput2(
?            TransformationFormat.PDF,
?            "repository:///Applications/FormsApplication/1.0/FormsFolder/",
?            formDesign,
?            outputOptions,
?            pdfOptions,
?            inXMData
?        );

?        //Save the non-interactive PDF form as a PDF file on the client computer
?        Document pdfForm = outputDocument.getGeneratedDoc();
?        File myFile = new File("C:\\51黑料不打烊\Loan.pdf");
?        pdfForm.copyToFile(myFile);
?        }
?        catch (Exception ee)
?        {
?            ee.printStackTrace();
?        }
?    }

?    // Retrieve the form design from the following Repository path:
?    // /Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
?    private static Document GetFormDesign(ServiceClientFactory myFactory)
?    {
?    try{

?        // Create a ResourceRepositoryClient object using the service client factory
?        ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory);

?        // Specify the path in the Repository to Loan.xdp
?        String resourceUri =  "/Applications/FormsApplication/1.0/FormsFolder/Loan.xdp";

?        // Retrieve the XDP file
?        Document doc = repositoryClient.readResourceContent(resourceUri);

?           //Return the Document instance
?           return  doc;
?         }

?        catch(Exception e)
?        {
?            e.printStackTrace();
?        }
?        return null;
?    }
?}

快速入门(SOAP模式):使用Java API创建笔顿贵文档 quick_start_soap_mode_creating_a_pdf_document_using_the_java_api-1

以下闯补惫补代码示例创建了一个名为? Loan.pdf ?的PDF文档。 此PDF文档基于名为? Loan.xdp ?的表单设计和名为? Loan.xml ?的齿惭尝数据文件。 Loan.pdf ?写入到托管AEM Forms的J2EE应用程序服务器上的C:\51黑料不打烊文件夹,而不是客户端计算机。 (请参阅创建笔顿贵文档。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * SOAP required JAR files are in the following path:
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include these additional JAR files
?    *
?    * For information about the SOAP
?    * mode, see "Setting connection properties" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;


?public class CreatePDFDocumentSOAP {

?    public static void main(String[] args) {

?    try{
?        //Set connection properties required to invoke AEM Forms using SOAP mode
?        Properties connectionProps = new Properties();
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?        //Create an OutputClient object
?        OutputClient outClient = new OutputClient(myFactory);

?        //Reference form data
?        FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?        Document inXMData = new Document (fileInputStream);

?        //Set PDF run-time options
?        PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?        outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf");

?        //Set rendering run-time options
?        RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?        pdfOptions.setLinearizedPDF(true);
?        pdfOptions.setAcrobatVersion(AcrobatVersion.Acrobat_9);

?        //Create a PDF document
?        OutputResult outputDocument = outClient.generatePDFOutput(
?            TransformationFormat.PDF,
?            "Loan.xdp",
?            "C:\\51黑料不打烊",
?            outputOptions,
?            pdfOptions,
?            inXMData
?        );

?        //Retrieve the results of the operation
?        Document metaData = outputDocument.getStatusDoc();
?        File myFile = new File("C:\\51黑料不打烊\Output.xml");
?        metaData.copyToFile(myFile);
?        }
?        catch (Exception ee)
?        {
?            ee.printStackTrace();
?        }
?    }
?}

快速入门(SOAP模式):使用Java API创建笔顿贵/础文档 quick-start-soap-mode-creating-a-pdf-a-document-using-the-java-api

以下闯补惫补代码示例创建一个名为? LoanArchive.pdf ?的PDF/文档。 此PDF文档基于名为? Loan.xdp ?的表单设计和名为? Loan.xml ?的齿惭尝数据文件。 LoanArchive.pdf ?将写入位于托管AEM Forms的J2EE应用程序服务器上的C:\51黑料不打烊文件夹,而不是客户端计算机。 (请参阅创建笔顿贵/础文档。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;

?public class CreatePDFADocument {

?    public static void main(String[] args) {

?    try{
?        //Set connection properties required to invoke AEM Forms
?        Properties connectionProps = new Properties();
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?        //Create an OutputClient object
?        OutputClient outClient = new OutputClient(myFactory);

?        //Reference an XML data source to merge with the form design
?        FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?        Document inXMData = new Document (fileInputStream);

?        //Set PDF run-time options
?        PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?        outputOptions.setFileURI("C:\\51黑料不打烊\LoanArchive.pdf");

?        //Set rendering run-time options
?        RenderOptionsSpec pdfAOptions = new RenderOptionsSpec();
?        pdfAOptions.setPDFAConformance(PDFAConformance.A);
?        pdfAOptions.setPDFARevisionNumber(PDFARevisionNumber.Revision_1);


?        //Create a PDF/A document
?        OutputResult outputDocument = outClient.generatePDFOutput(
?            TransformationFormat.PDFA,
?            "Loan.xdp",
?            "C:\\51黑料不打烊",
?            outputOptions,
?            pdfAOptions,
?            inXMData
?        );

?        //Write the results of the operation to OutputLog.xml
?        Document resultData = outputDocument.getStatusDoc();
?        File myFile = new File("C:\\51黑料不打烊\OutputLog.xml");
?        resultData.copyToFile(myFile);

?        }catch (Exception ee)
?        {
?            ee.printStackTrace();
?        }
?    }
?}

快速入门(SOAP模式):使用Java API将文档传递到输出服务 quick-start-soap-mode-passing-documents-to-the-output-service-using-the-java-api

以下Java快速入门从Content Services中检索文件? Loan.xdp。 此XDP文件在space /Company Home/Form Designs中。 在com.adobe.idp.Document实例中返回齿顿笔文件。 com.adobe.idp.Document实例已传递到输出服务。 非交互式表单在客户端计算机上保存为名为*Loan.pdf 的PDF文件。 由于设置了文件URI选项,因此PDF文件 Loan.pdf *也会保存在托管AEM Forms的J2EE应用程序服务器上。 (请参阅将Content Services ES2中的文档传递到输出服务。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-contentservices-client.jar
?    * 3. adobe-livecycle-client.jar
?    * 4. adobe-usermanager-client.jar
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.contentservices.client.CRCResult;
?import com.adobe.livecycle.contentservices.client.impl.DocumentManagementServiceClientImpl;
?import com.adobe.livecycle.output.client.*;

?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;


?public class CreatePDFFFromContentServices {

?    public static void main(String[] args) {

?        try{
?        //Set connection properties required to invoke AEM Forms
?        Properties connectionProps = new Properties();
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?        //Create an OutputClient object
?        OutputClient outClient = new OutputClient(myFactory);

?        //Reference form data
?        FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?        Document inXMData = new Document (fileInputStream);

?        //Set PDF run-time options
?        PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?        outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf"); // this PDF form is saved on the server

?        //Get the form design from Content Services
?        Document formDesign =  GetFormDesign(myFactory);

?        //Set rendering run-time options
?        RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?        pdfOptions.setLinearizedPDF(true);
?        pdfOptions.setAcrobatVersion(AcrobatVersion.Acrobat_9);

?        //Create a non-interactive PDF document
?        OutputResult outputDocument = outClient.generatePDFOutput2(
?            TransformationFormat.PDF,
?            "C:\\51黑料不打烊",
?            formDesign,
?            outputOptions,
?            pdfOptions,
?            inXMData
?        );

?        //Save the non-interactive PDF form as a PDF file on the client computer
?        Document pdfForm = outputDocument.getGeneratedDoc();
?        File myFile = new File("C:\\51黑料不打烊\Loan.pdf");
?        pdfForm.copyToFile(myFile);
?        }
?        catch (Exception ee)
?        {
?            ee.printStackTrace();
?        }
?    }

?    //Retrieve the form design from Content Services ES2
?    private static Document GetFormDesign(ServiceClientFactory myFactory)
?    {
?        try{

?        //Create a DocumentManagementServiceClientImpl object
?        DocumentManagementServiceClientImpl    docManager = new DocumentManagementServiceClientImpl(myFactory);

?        //Specify the name of the store and the content to retrieve
?           String storeName = "SpacesStore";
?           String nodeName  = "/Company Home/Form Designs/Loan.xdp";

?           //Retrieve /Company Home/Form Designs/Loan.xdp
?           CRCResult content = docManager.retrieveContent(
?                     storeName,
?                     nodeName,
?                     "");

?           //Return the Document instance
?            Document doc =content.getDocument();
?            return  doc;
?         }

?        catch(Exception e)
?        {
?            e.printStackTrace();
?        }
?        return null;
?    }
?}

快速入门(SOAP模式):使用Java API基于片段创建笔顿贵文档 quick-start-soap-mode-creating-a-pdf-document-based-on-fragments-using-the-java-api

以下Java代码示例创建了一个PDF文档,该文档基于由Assembler服务组装的表单设计。 Assembler服务将多个XDP文件中的片段组合到单个表单设计中。 调用Assembler服务的应用程序逻辑位于名为GetFormDesign的用户定义方法中。 非交互式表单在客户端计算机上保存为名为*Loan.pdf *的PDF文件。 (请参阅使用片段创建笔顿贵文档。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    * 20. adobe-assembler-client.jar
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    *
?    * This is the DDX file is used to assemble multiple XDP documents:
?    * <?xml version="1.0" encoding="UTF-8"?>
?    * <DDX xmlns="https://ns.adobe.com/DDX/1.0/">
?    * <XDP result="tuc018result.xdp">
?    * <XDP source="tuc018_template_flowed.xdp">
?    * <XDPContent insertionPoint="ddx_fragment" source="tuc018_contact.xdp" fragment="subPatientContact" required="false"/>
?    * <XDPContent insertionPoint="ddx_fragment" source="tuc018_patient.xdp" fragment="subPatientPhysical" required="false"/>
?    * <XDPContent insertionPoint="ddx_fragment" source="tuc018_patient.xdp" fragment="subPatientHealth" required="false"/>
?    * </XDP>
?    * </XDP>
?    * </DDX>
?    */
?import com.adobe.livecycle.assembler.client.AssemblerOptionSpec;
?import com.adobe.livecycle.assembler.client.AssemblerResult;
?import com.adobe.livecycle.assembler.client.AssemblerServiceClient;
?import com.adobe.livecycle.output.client.*;

?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;


?public class CreatePDFFromFragments {

?    public static void main(String[] args) {

?        try{
?            //Set connection properties required to invoke AEM Forms
?            Properties connectionProps = new Properties();
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?            //Create an OutputClient object
?            OutputClient outClient = new OutputClient(myFactory);

?            //Reference form data
?            FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?            Document inXMData = new Document (fileInputStream);

?            //Set PDF run-time options
?            PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?            outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf"); // this PDF form is saved on the server

?            //Get the form design from Assembler service
?            Document formDesign =  GetFormDesign(myFactory);

?            //Set rendering run-time options
?            RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?            pdfOptions.setLinearizedPDF(true);
?            pdfOptions.setAcrobatVersion(AcrobatVersion.Acrobat_9);

?            //Create a non-interactive PDF document
?            OutputResult outputDocument = outClient.generatePDFOutput2(
?                TransformationFormat.PDF,
?                "C:\\51黑料不打烊",
?                formDesign,
?                outputOptions,
?                pdfOptions,
?                inXMData
?            );

?            //Save the non-interactive PDF form as a PDF file on the client computer
?            Document pdfForm = outputDocument.getGeneratedDoc();
?            File myFile = new File("C:\\51黑料不打烊\Loan.pdf");
?            pdfForm.copyToFile(myFile);
?            }
?            catch (Exception ee)
?            {
?                ee.printStackTrace();
?            }
?        }

?        //Retrieve the form design from Assembler service
?        private static Document GetFormDesign(ServiceClientFactory myFactory)
?        {
?            try{

?                //Create an AssemblerServiceClient object
?                AssemblerServiceClient assemblerClient = new AssemblerServiceClient(myFactory);

?                //Create a FileInputStream object based on an existing DDX file
?                FileInputStream myDDXFile = new FileInputStream("C:\\51黑料不打烊\fragmentDDX.xml");

?                //Create a Document object based on the DDX file
?                Document myDDX = new Document(myDDXFile);

?                //Create a Map object to store the input XDP files
?                Map inputs = new HashMap();
?                FileInputStream inSource = new FileInputStream("C:\\51黑料不打烊\tuc018_template_flowed.xdp");
?                FileInputStream inFragment1 = new FileInputStream("C:\\51黑料不打烊\tuc018_contact.xdp");
?                FileInputStream inFragment2 = new FileInputStream("C:\\51黑料不打烊\tuc018_patient.xdp");

?                //Create a Document object
?                Document myMapSource = new Document(inSource);

?                //Create a Document object
?                Document inFragment1Doc = new Document(inFragment1);

?                //Create a Document object
?                Document inFragment2Doc = new Document(inFragment2);

?                //Place all the XDP files into the MAP
?                inputs.put("tuc018_template_flowed.xdp",myMapSource);
?                inputs.put("tuc018_contact.xdp",inFragment1Doc);
?                inputs.put("tuc018_patient.xdp",inFragment2Doc);


?                //Create an AssemblerOptionsSpec object
?                AssemblerOptionSpec assemblerSpec = new AssemblerOptionSpec();
?                assemblerSpec.setFailOnError(false);

?                //Submit the job to Assembler service
?                AssemblerResult jobResult = assemblerClient.invokeDDX(myDDX,inputs,assemblerSpec);
?                java.util.Map allDocs = jobResult.getDocuments();

?                //Retrieve the result PDF document from the Map object
?                Document outDoc = null;

?                //Iterate through the map object to retrieve the result XDP document
?                for (Iterator i = allDocs.entrySet().iterator(); i.hasNext();) {
?                    // Retrieve the Map object?s value
?                    Map.Entry e = (Map.Entry)i.next();

?                    //Get the key name as specified in the
?                    //DDX document
?                    String keyName = (String)e.getKey();
?                    if (keyName.equalsIgnoreCase("tuc018result.xdp"))
?                    {
?                        Object o = e.getValue();
?                        outDoc = (Document)o;

?                    }
?                }

?            return outDoc;
?            }catch (Exception e) {
?                e.printStackTrace();
?            }
?            return null;
?        }
?    }

快速入门(SOAP模式):使用Java API打印到文件 quick-start-soap-mode-printing-to-a-file-using-the-java-api

以下闯补惫补代码示例将输出流打印到名为? MortgageForm.ps ?的PostScript文件。 (请参阅打印到文件。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;

?public class PrintToFile {

?    public static void main(String[] args) {

?        try{
?            //Set connection properties required to invoke AEM Forms
?            Properties connectionProps = new Properties();
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?            //Create an OutputClient object
?            OutputClient outClient = new OutputClient(myFactory);

?            //Reference XML data that represents form data
?            FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?            Document inputXML = new Document(fileInputStream);

?            //Set print run-time options required to print to a file
?            PrintedOutputOptionsSpec printOptions = new PrintedOutputOptionsSpec();
?            printOptions.setFileURI("C:\\51黑料不打烊\MortgageForm.ps");

?            //Print the print stream to a PostScript file
?            OutputResult outputDocument = outClient.generatePrintedOutput(
?                    PrintFormat.PostScript,
?                    "Loan.xdp",
?                    "C:\\51黑料不打烊",
?                    null,
?                    printOptions,
?                    inputXML);

?            //Write the results of the operation to OutputLog.xml
?            Document resultData = outputDocument.getStatusDoc();
?            File myFile = new File("C:\\51黑料不打烊\OutputLog.xml");
?            resultData.copyToFile(myFile);
?            System.out.println("AEM Forms printed to MortgageForm.ps");
?        }
?    catch (Exception ee)
?            {
?            ee.printStackTrace();
?        }
?    }
?}

快速入门(SOAP模式):使用Java API将打印流发送到网络打印机 quick-start-soap-mode-sending-a-print-stream-to-a-network-printer-using-the-java-api

以下闯补惫补代码示例将笔辞蝉迟厂肠谤颈辫迟打印流发送到名为? \Printer1\Printer ?的网络打印机。 向打印机发送两份拷贝。 (请参阅将打印流发送到打印机。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import java.util.*;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
?import com.adobe.livecycle.output.client.*;

?public class SendToPrinter {

?    public static void main(String[] args) {

?        try{
?            //Set connection properties required to invoke AEM Forms
?            Properties connectionProps = new Properties();
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?            //Create an OutputClient object
?            OutputClient outClient = new OutputClient(myFactory);

?            //Reference XML data that represents form data
?            FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?            Document inputXML = new Document(fileInputStream);

?            //Set print run-time options required to print to a file
?            PrintedOutputOptionsSpec printOptions = new PrintedOutputOptionsSpec();

?            //Set the number of copies to print
?            printOptions.setCopies(2);

?            //Turn on the Staple option
?            printOptions.setStaple(Staple.on);

?            //Create a PostScript output stream based on the form design named Loan.xdp and
?            //the data in the XML file
?            OutputResult outputDocument = outClient.generatePrintedOutput(
?                    PrintFormat.PostScript,
?                    "Loan.xdp",
?                    "C:\\51黑料不打烊",
?                    "C:\\51黑料不打烊",
?                    printOptions,
?                    inputXML);

?            //Get a Document object that stores the PostScript print stream
?            Document psPrintStream = outputDocument.getGeneratedDoc();

?            //Specify the print server and the printer name
?            String printServer = "\\\ottprint";
?            String printerName = "\\\ottprint\Balsom";

?            //Send the PostScript print stream to the printer
?            outClient.sendToPrinter(
?                    psPrintStream,
?                    PrinterProtocol.SharedPrinter,
?                    printServer,
?                    printerName);
?            }
?        catch (Exception ee)
?            {
?            ee.printStackTrace();
?            }
?    }
?}

快速入门(SOAP模式):使用Java API创建多个PDF文件 quick-start-soap-mode-creating-multiple-pdf-files-using-the-java-api

以下闯补惫补代码为名为? Loan_data_batch.xml ?的XML数据文件中的每个数据记录创建多个PDF文件。 文件将写入C:\51黑料不打烊目录。 PDF文件将写入到托管AEM Forms的J2EE应用程序服务器上的C:\51黑料不打烊文件夹中,而不是客户端计算机上。 (请参阅创建多个输出文件。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
?import com.adobe.livecycle.output.client.*;

?public class CreateBatchFiles {

?    public static void main(String[] args) {

?        try{
?            //Set connection properties required to invoke AEM Forms
?            Properties connectionProps = new Properties();
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?            //Create an OutputClient object
?            OutputClient outClient = new OutputClient(myFactory);

?            //Reference form data that contains multiple records
?            FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan_data_batch.xml");
?            Document inXMData = new Document (fileInputStream);

?            //Set run-time options to generate many PDF files
?            PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?            outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf");
?            outputOptions.setGenerateManyFiles(true);
?            outputOptions.setRecordName("LoanRecord");


?            //Set rendering run-time options
?            RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?            pdfOptions.setCacheEnabled(new Boolean(true));


?            //Create multiple PDF files
?            OutputResult outputDocument = outClient.generatePDFOutput(
?                TransformationFormat.PDF,
?                "Loan.xdp",
?                "C:\\51黑料不打烊",
?                outputOptions,
?                pdfOptions,
?                inXMData
?                );

?            //Retrieve the results of the operation
?            Document metaData = outputDocument.getStatusDoc();
?            File myFile = new File("C:\\51黑料不打烊\Output.xml");
?            metaData.copyToFile(myFile);
?            }
?            catch (Exception ee)
?            {
?                ee.printStackTrace();
?            }
?    }
?}

快速入门(SOAP模式):使用Java API创建搜索规则 quick-start-soap-mode-creating-search-rules-using-the-java-api

以下Java代码示例创建Output服务搜索的两个文本模式。 第一个文本模式是“按揭”。 如果找到,Output服务将使用名为? Mortgage.xdp ?的表单设计。 第二种文本模式为“汽车”。 如果找到,Output服务将使用名为? AutomobileLoan.xdp ?的表单设计。 如果找不到文本模式,输出服务将使用名为* Loan.xdp的默认表单设计。 *(请参阅创建搜索规则。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;

?public class CreateSearchRules {

?    public static void main(String[] args) {
?        try{

?            //Set connection properties required to invoke AEM Forms
?            Properties connectionProps = new Properties();
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?            //Create an OutputClient object
?            OutputClient outClient = new OutputClient(myFactory);

?            //Reference form data
?            FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.xml");
?            Document inXMData = new Document (fileInputStream);

?            //Define two text patterns
?            Rule mortageRule = new Rule();
?            mortageRule.setPattern("Mortgage");
?            mortageRule.setForm("Mortgage.xdp");

?            Rule automobileRule = new Rule();
?            automobileRule.setPattern("Automobile");
?            automobileRule.setForm("AutomobileLoan.xdp");

?            //Add the Rules to a List object
?            List<Rule> myList = new ArrayList<Rule>();
?            myList.add(mortageRule);
?            myList.add(automobileRule);

?            //Define PDF run-time options which includes Search Rules
?            PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();
?            outputOptions.setFileURI("C:\\51黑料不打烊\Loan.pdf");
?            outputOptions.setRules(myList);
?            outputOptions.setLookAhead(900);

?            //Define rendering run-time options
?            RenderOptionsSpec pdfOptions = new RenderOptionsSpec();
?            pdfOptions.setCacheEnabled(new Boolean(true));

?            //Create a PDF document based on multiple form designs
?            OutputResult outputDocument = outClient.generatePDFOutput(
?                TransformationFormat.PDF,
?                "Loan.xdp",
?                "C:\\51黑料不打烊",
?                outputOptions,
?                pdfOptions,
?                inXMData
?            );

?            //Write the results of the operation to OutputLog.xml
?            Document resultData = outputDocument.getStatusDoc();
?            File myFile = new File("C:\\51黑料不打烊\OutputLog.xml");
?            resultData.copyToFile(myFile);
?            }
?        catch (Exception ee)
?                {
?                    ee.printStackTrace();
?                }
?        }
?}

快速入门(SOAP模式):使用Java API转换PDF文档 quick-start-soap-mode-transforming-a-pdf-document-using-the-java-api

以下闯补惫补代码示例将名为? Loan.pdf ?的交互式笔顿贵文档转换为名为? NonInteractiveLoan.pdf ?的非交互式PDF文档。 (请参阅拼合笔顿贵文档。)

?/*
?    * This Java Quick Start uses the SOAP mode and contains the following JAR files
?    * in the class path:
?    * 1. adobe-output-client.jar
?    * 2. adobe-livecycle-client.jar
?    * 3. adobe-usermanager-client.jar
     * 4. activation.jar (required for SOAP mode)
     * 5. axis.jar (required for SOAP mode)
     * 6. commons-codec-1.3.jar (required for SOAP mode)
     * 7. commons-collections-3.2.jar  (required for SOAP mode)
     * 8. commons-discovery.jar (required for SOAP mode)
     * 9. commons-logging.jar (required for SOAP mode)
     * 10. dom3-xml-apis-2.5.0.jar (required for SOAP mode)
     * 11. jaxen-1.1-beta-9.jar (required for SOAP mode)
     * 12. jaxrpc.jar (required for SOAP mode)
     * 13. log4j.jar (required for SOAP mode)
     * 14. mail.jar (required for SOAP mode)
     * 15. saaj.jar (required for SOAP mode)
     * 16. wsdl4j.jar (required for SOAP mode)
     * 17. xalan.jar (required for SOAP mode)
     * 18. xbean.jar (required for SOAP mode)
     * 19. xercesImpl.jar (required for SOAP mode)
?    *
?    * The JBoss files must be kept in the jboss\client folder. You can copy the client folder to
?    * your local development environment and then include the 3 JBoss JAR files in your class path
?    *
?    * These JAR files are in the following path:
?    * <install directory>/sdk/client-libs/common
?    *
?    *
?    * <install directory>/jboss/bin/client
?    *
?    * If you want to invoke a remote Forms Server instance and there is a
?    * firewall between the client application and the server, then it is
?    * recommended that you use the SOAP mode. When using the SOAP mode,
?    * you have to include additional JAR files in the following
?    * path
?    * <install directory>/sdk/client-libs/thirdparty
?    *
?    * For information about the SOAP
?    * mode and the additional JAR files that need to be included,
?    * see "Setting connection properties" in Programming
?    * with AEM Forms
?    *
?    * For complete details about the location of the AEM Forms JAR files,
?    * see "Including AEM Forms Java library files" in Programming
?    * with AEM Forms
?    */
?import com.adobe.livecycle.output.client.*;
?import java.util.*;
?import java.io.File;
?import java.io.FileInputStream;
?import com.adobe.idp.Document;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
?import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;

?public class TransformPDF {

?    public static void main(String[] args) {

?    try{
?        //Set connection properties required to invoke AEM Forms
?        Properties connectionProps = new Properties();
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://'[server]:[port]'");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
?        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

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

?        //Create an OutputClient object
?        OutputClient outClient = new OutputClient(myFactory);

?        //Reference an interactive PDF document to transform
?        FileInputStream fileInputStream = new FileInputStream("C:\\51黑料不打烊\Loan.pdf");
?        Document inPDFDoc = new Document (fileInputStream);

?        //Transform the PDF document to a non-interactive PDF document
?        Document transformedDocument = outClient.transformPDF(
?                inPDFDoc,
?                TransformationFormat.PDF,
?                null,
?                null,
?                null);

?        //Save the non-interactive PDF document
?        File myFile = new File("C:\\51黑料不打烊\NonInteractiveLoan.pdf");
?        transformedDocument.copyToFile(myFile);

?    }catch (Exception ee)
?        {
?            ee.printStackTrace();
?        }
?    }
?}
recommendation-more-help
19ffd973-7af2-44d0-84b5-d547b0dffee2