Expand my Community achievements bar.

generatePDFOutput is not invoked

Avatar

Former Community Member
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;


public class CreatePDFDocument {

public static void main(String[] args) {
 
  try{
  //Set LiveCycle ES service connection properties       
  Properties ConnectionProps = new Properties();
  ConnectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "jnp://localhost:1099");
  ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");         
  ConnectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
  ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
  ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
    
  //Create a ServiceClientFactory object
  ServiceClientFactory myFactory = ServiceClientFactory.createInstance(ConnectionProps);
   
  //Create a SignatureServiceClient object
  OutputClient outClient = new OutputClient(myFactory);
       
  //Reference form data       
  FileInputStream fileInputStream = new FileInputStream("C:\\Adobe\\Loan_data.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);
   
  //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();
  }
 
}
}



While Trying to run this sample i am getting the following message "Unable to create / open file C:\Adobe\Loan.pdf" in Output.xml file
outClient.generatePDFOutput is not called...
Please suggest me i am new Adobe Lifecycle.
1 Reply

Avatar

Level 2

May be a Loan.pdf exists and is open!

Also, try using the SOAP endpoint. The EJB endpoint is usually problematic. See if it helps.