출력 서비스 Java API 빠른 시작(SOAP)

출력 서비스에서 Java API 빠른 시작(SOAP)을 사용할 수 있습니다.

빠른 시작(SOAP 모드):Java API를 사용하여 PDF 문서 만들기

빠른 시작(SOAP 모드):Java API를 사용하여 애플리케이션 XDP 파일을 기반으로 PDF 문서 만들기

빠른 시작(SOAP 모드):Java API를 사용하여 PDF/A 문서 만들기

빠른 시작(SOAP 모드):Java API를 사용하여 출력 서비스에 문서 전달

빠른 시작(SOAP 모드):Java API를 사용하여 AEM Forms 리포지토리에 있는 문서를 출력 서비스로 전달

빠른 시작(SOAP 모드):Java API를 사용하여 조각을 기반으로 PDF 문서 만들기

빠른 시작(SOAP 모드):Java API를 사용하여 파일에 인쇄

빠른 시작(SOAP 모드):Java API를 사용하여 네트워크 프린터로 인쇄 스트림 보내기

빠른 시작(SOAP 모드):Java API를 사용하여 여러 PDF 파일 만들기

빠른 시작(SOAP 모드):Java API를 사용하여 검색 규칙 만들기

빠른 시작(SOAP 모드):Java API를 사용하여 PDF 문서 변환

AEM Forms 작업은 AEM Forms 강력한 형식의 API를 사용하여 수행할 수 있으며 연결 모드는 SOAP로 설정해야 합니다.

노트

AEM 양식을 사용한 프로그래밍에 있는 빠른 시작은 Forms Server 운영 체제를 기반으로 합니다. 그러나 UNIX와 같은 다른 운영 체제를 사용하는 경우에는 Windows 관련 경로를 해당 운영 체제에서 지원하는 경로로 바꿉니다. 마찬가지로, 다른 J2EE 응용 프로그램 서버를 사용하는 경우 올바른 연결 속성을 지정해야 합니다. 연결 속성 설정을 참조하십시오

빠른 시작(SOAP 모드):Java API를 사용하여 PDF 문서 만들기

다음 Java 코드 예제에서는 Loan.pdf​라는 PDF 문서를 만듭니다. 이 PDF 문서는 Loan.xdp​라는 양식 디자인과 Loan.xml​이라는 XML 데이터 파일을 기반으로 합니다. Loan.pdf​는 클라이언트 컴퓨터가 아닌 C:\Adobe folder located on the J2EE application server hosting AEM Forms에 작성됩니다. ( 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 located 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 located 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:\\Adobe\Loan.xml");     
         Document inXMData = new Document (fileInputStream); 
                  
         //Set PDF run-time options     
         PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec(); 
         outputOptions.setFileURI("C:\\Adobe\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:\\Adobe", 
             outputOptions, 
             pdfOptions, 
             inXMData 
         ); 
                  
         //Retrieve the results of the operation 
         Document metaData = outputDocument.getStatusDoc(); 
         File myFile = new File("C:\\Adobe\Output.xml"); 
         metaData.copyToFile(myFile); 
         } 
         catch (Exception ee) 
         { 
             ee.printStackTrace(); 
         } 
     } 
 } 
 

빠른 시작(SOAP 모드):Java API를 사용하여 애플리케이션 XDP 파일을 기반으로 PDF 문서 만들기

다음 Java 코드 예제에서는 Loan.pdf​라는 PDF 문서를 만듭니다. 이 PDF 문서는 Loan.xdp​라는 양식 디자인과 Loan.xml​이라는 XML 데이터 파일을 기반으로 합니다. XDP 파일은 Applications/FormsApplication이라는 AEM Forms 애플리케이션의 일부로 배포됩니다. URI 경로는 repository:///Applications/FormsApplication/1.0/FormsFolder/입니다. Loan.pdf​는 클라이언트 컴퓨터가 아닌 C:\Adobe folder located on the J2EE application server hosting AEM Forms에 작성됩니다. ( PDF 문서 만들기 참조)

노트

이 빠른 시작을 실행하기 전에 Applications/FormsApplication이라는 AEM Forms 애플리케이션을 만들어야 합니다. FormsFolder라는 응용 프로그램 내에 폴더를 만들고 XDP 파일을 폴더에 넣습니다. 자세한 내용은 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) 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/Adobe/adobe_experience_manager_forms/SDK/client-libs/common 
     * 
     * <install directory>/Adobe/adobe_experience_manager_forms/SDK/client-libs/jboss 
     * 
     * <install directory>/Adobe/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 located in the following  
     * path 
     * <install directory>/Adobe/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:\\Adobe\Loan.xml");     
         Document inXMData = new Document (fileInputStream); 
                  
         //Set PDF run-time options     
         PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec(); 
         outputOptions.setFileURI("C:\\Adobe\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:\\Adobe\Output.xml"); 
         metaData.copyToFile(myFile); 
         } 
         catch (Exception ee) 
         { 
             ee.printStackTrace(); 
         } 
     } 
 } 
  
 

빠른 시작(SOAP 모드):Java API를 사용하여 저장소에 있는 문서를 출력 서비스에 전달합니다

다음 Java 코드는 저장소에서 XDP 파일을 검색하고 com.adobe.idp.Document 인스턴스 내의 출력 서비스에 전달합니다. XDP 파일은 Applications/FormsApplication이라는 AEM Forms 애플리케이션의 일부로 배포됩니다. URI 경로는 repository:///Applications/FormsApplication/1.0/FormsFolder/입니다.

노트

저장소 API는 이 위치에서 XDP 파일을 검색하는 데 사용됩니다. (리소스 읽기 참조)

또한 컨텐츠 루트 값 repository:///Applications/FormsApplication/1.0/FormsFolder/OutputClient 개체의 generatePDFOutput2 메서드(두 번째 매개 변수)에 전달되었음을 알 수 있습니다. 이 값은 출력 서비스에 전달되어 이 위치에 이미지 등의 자료를 구성하는 것을 출력 서비스에 알립니다.

노트

generatePrintedOutput2 메서드를 호출할 때 동일한 방법으로 컨텐츠 루트 값을 설정할 수 있습니다.

Loan.pdf​는 C:\Adobe folder located on the J2EE application server hosting AEM Forms에 작성됩니다. (저장소에 있는 문서를 출력 서비스에 전달을 참조하십시오.)

노트

이 빠른 시작을 실행하기 전에 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 located 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 located 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:\\Adobe\Loan.xml");     
         Document inXMData = new Document (fileInputStream); 
                  
         //Set PDF run-time options     
         PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec(); 
         outputOptions.setFileURI("C:\\Adobe\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:\\Adobe\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를 사용하여 PDF 문서 만들기

다음 Java 코드 예제에서는 Loan.pdf​라는 PDF 문서를 만듭니다. 이 PDF 문서는 Loan.xdp​라는 양식 디자인과 Loan.xml​이라는 XML 데이터 파일을 기반으로 합니다. Loan.pdf​는 클라이언트 컴퓨터가 아닌 C:\Adobe folder located on the J2EE application server hosting AEM Forms에 작성됩니다. ( 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) 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * 
     * <install directory>/jboss/bin/client 
     * 
     * SOAP required JAR files are located 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:\\Adobe\Loan.xml");     
         Document inXMData = new Document (fileInputStream); 
                  
         //Set PDF run-time options     
         PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec(); 
         outputOptions.setFileURI("C:\\Adobe\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:\\Adobe", 
             outputOptions, 
             pdfOptions, 
             inXMData 
         ); 
                  
         //Retrieve the results of the operation 
         Document metaData = outputDocument.getStatusDoc(); 
         File myFile = new File("C:\\Adobe\Output.xml"); 
         metaData.copyToFile(myFile); 
         } 
         catch (Exception ee) 
         { 
             ee.printStackTrace(); 
         } 
     } 
 }

빠른 시작(SOAP 모드):Java API를 사용하여 PDF/A 문서 만들기

다음 Java 코드 예제에서는 LoanArchive.pdf​라는 PDF/A 문서를 만듭니다. 이 PDF 문서는 Loan.xdp​라는 양식 디자인과 Loan.xml​이라는 XML 데이터 파일을 기반으로 합니다. LoanArchive.pdf​는 클라이언트 컴퓨터가 아닌 C:\Adobe folder located on the J2EE application server hosting AEM Forms에 작성됩니다. (PDF/A 문서 작성을 참조하십시오.)

 /* 
     * 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 located 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 located 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:\\Adobe\Loan.xml");     
         Document inXMData = new Document (fileInputStream); 
              
         //Set PDF run-time options     
         PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec(); 
         outputOptions.setFileURI("C:\\Adobe\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:\\Adobe", 
             outputOptions, 
             pdfAOptions, 
             inXMData 
         ); 
          
         //Write the results of the operation to OutputLog.xml 
         Document resultData = outputDocument.getStatusDoc(); 
         File myFile = new File("C:\\Adobe\OutputLog.xml"); 
         resultData.copyToFile(myFile); 
          
         }catch (Exception ee) 
         { 
             ee.printStackTrace(); 
         } 
     } 
 } 
 

빠른 시작(SOAP 모드):Java API를 사용하여 출력 서비스에 문서 전달

다음 Java 빠른 시작은 Content Services에서 Loan.xdp 파일을 검색합니다. 이 XDP 파일은 space /Company Home/Form Designs에 있습니다. XDP 파일이 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 located 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 located 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:\\Adobe\Loan.xml");     
         Document inXMData = new Document (fileInputStream); 
                  
         //Set PDF run-time options     
         PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec(); 
         outputOptions.setFileURI("C:\\Adobe\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:\\Adobe", 
             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:\\Adobe\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를 사용하여 조각을 기반으로 PDF 문서 만들기

다음 Java 코드 예제에서는 어셈블러 서비스에서 어셈블한 양식 디자인을 기반으로 하는 PDF 문서를 만듭니다. 어셈블러 서비스는 여러 XDP 파일에 있는 조각을 단일 양식 디자인에 결합합니다. 어셈블러 서비스를 호출하는 응용 프로그램 로직은 GetFormDesign 사용자 정의 메서드에 있습니다. 비대화형 양식은 클라이언트 컴퓨터에 *Loan.pdf *라는 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 located 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 located 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:\\Adobe\Loan.xml");     
             Document inXMData = new Document (fileInputStream); 
                      
             //Set PDF run-time options     
             PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec(); 
             outputOptions.setFileURI("C:\\Adobe\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:\\Adobe", 
                 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:\\Adobe\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:\\Adobe\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:\\Adobe\tuc018_template_flowed.xdp"); 
                 FileInputStream inFragment1 = new FileInputStream("C:\\Adobe\tuc018_contact.xdp"); 
                 FileInputStream inFragment2 = new FileInputStream("C:\\Adobe\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 of 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를 사용하여 파일에 인쇄

다음 Java 코드 예제에서는 출력 스트림을 ModerationForm.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 located 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 located 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:\\Adobe\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:\\Adobe\MortgageForm.ps"); 
              
             //Print the print stream to a PostScript file 
             OutputResult outputDocument = outClient.generatePrintedOutput( 
                     PrintFormat.PostScript, 
                     "Loan.xdp", 
                     "C:\\Adobe", 
                     null, 
                     printOptions, 
                     inputXML);  
          
             //Write the results of the operation to OutputLog.xml 
             Document resultData = outputDocument.getStatusDoc(); 
             File myFile = new File("C:\\Adobe\OutputLog.xml"); 
             resultData.copyToFile(myFile); 
             System.out.println("AEM Forms printed to MortgageForm.ps"); 
         } 
     catch (Exception ee) 
             { 
             ee.printStackTrace(); 
         } 
     } 
 } 
 

빠른 시작(SOAP 모드):Java API를 사용하여 인쇄 스트림을 네트워크 프린터로 보내는 중

다음 Java 코드 예제에서는 PostScript 인쇄 스트림을 \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 located 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 located 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:\\Adobe\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 located in the XML file 
             OutputResult outputDocument = outClient.generatePrintedOutput( 
                     PrintFormat.PostScript, 
                     "Loan.xdp", 
                     "C:\\Adobe", 
                     "C:\\Adobe", 
                     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 파일 만들기

다음 Java 코드는 Loan_data_batch.xml​이라는 XML 데이터 파일에 있는 각 데이터 레코드에 대한 여러 PDF 파일을 생성합니다. 파일은 C:\Adobe directory폴더에 작성됩니다. PDF 파일은 클라이언트 컴퓨터가 아니라 C:\Adobe folder located on the J2EE application server hosting AEM Forms에 작성됩니다. (여러 출력 파일 만들기 참조)

 /* 
     * 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 located 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 located 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:\\Adobe\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:\\Adobe\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:\\Adobe", 
                 outputOptions, 
                 pdfOptions, 
                 inXMData 
                 ); 
                  
             //Retrieve the results of the operation 
             Document metaData = outputDocument.getStatusDoc(); 
             File myFile = new File("C:\\Adobe\Output.xml"); 
             metaData.copyToFile(myFile); 
             } 
             catch (Exception ee) 
             { 
                 ee.printStackTrace(); 
             } 
     } 
 } 
  
 

빠른 시작(SOAP 모드):Java API를 사용하여 검색 규칙 만들기

다음 Java 코드 예제에서는 출력 서비스가 검색하는 두 개의 텍스트 패턴을 만듭니다. 첫 번째 텍스트 패턴은 저당권입니다. 발견된 경우 출력 서비스는 Moderation.xdp​라는 양식 디자인을 사용합니다. 두 번째 텍스트 패턴은 자동차입니다. 발견된 경우 출력 서비스는 AutomaticLoan.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 located 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 located 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:\\Adobe\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:\\Adobe\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:\\Adobe", 
                 outputOptions, 
                 pdfOptions, 
                 inXMData 
             ); 
          
             //Write the results of the operation to OutputLog.xml 
             Document resultData = outputDocument.getStatusDoc(); 
             File myFile = new File("C:\\Adobe\OutputLog.xml"); 
             resultData.copyToFile(myFile); 
             } 
         catch (Exception ee) 
                 { 
                     ee.printStackTrace(); 
                 } 
         } 
 } 
 

빠른 시작(SOAP 모드):Java API를 사용하여 PDF 문서 변환

다음 Java 코드 예제에서는 Loan.pdf​라는 대화형 PDF 문서를 NonInteractiveLoan.pdf​라는 비대화형 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 located 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 located 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:\\Adobe\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:\\Adobe\NonInteractiveLoan.pdf"); 
         transformedDocument.copyToFile(myFile); 
          
     }catch (Exception ee) 
         { 
             ee.printStackTrace(); 
         } 
     } 
 } 
 

이 페이지에서는