Expand my Community achievements bar.

Convert Excel to Pdf

Avatar

Level 1

I am able convert .doc file to pdf successfully using livecycle.

I am using to same code to convert excel file to pdf .

But it is throwing exception like

com.adobe.livecycle.generatepdf.client.ConversionException: ALC-PDG-011-019-The source file you submitted is invalid.

Can anyone help me how to convert excel file to pdf using livecycle.?

Here is the code I have written


              connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, DEFAULT_EJB_ENDPOINT);
               connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);         
               connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "WebLogic");
               connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, CREDENTIAL_USERNAME);
               connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, CREDENTIAL_PASSWORD);
  

               //Create a ServiceClientFactory instance
               ServiceClientFactory  factory   = ServiceClientFactory.createInstance(connectionProps);
                              
               //Create a GeneratePdfServiceClient object
               GeneratePdfServiceClient pdfGenClient  = new GeneratePdfServiceClient(factory);
              
               FileInputStream fileInputStream  = new FileInputStream(origFileName);
               com.adobe.idp.Document inDoc   = new com.adobe.idp.Document(fileInputStream);
              
              
               //Set createPDF parameter values
               String adobePDFSettings = "Standard";
               String securitySettings = "No Security";
               String fileTypeSettings = "Standard";
              
               //Convert the Word document to a PDF document
               CreatePDFResult result = pdfGenClient.createPDF2(inDoc,mimeType,fileTypeSettings,
                                       adobePDFSettings,securitySettings,
                                       null,null);
              
               //Get the newly created document
               com.adobe.idp.Document createdDocument = result.getCreatedDocument();
               //Save the converted PDF document as a PDF file
               String outputFilePath;
               outputFilePath     = origFileName.replaceFirst("."+mimeType,".pdf");
               System.out.println("outputFilePath="+outputFilePath);
               String outputFileName;
              
               outputFileName     = origFileName.replaceFirst("."+mimeType,".pdf");
               System.out.println("outputFileName="+outputFileName);
               createdDocument.copyToFile(new File(outputFilePath));

Thnaks in advance.

0 Replies