Expand my Community achievements bar.

Convert PDF to Postscript

Avatar

Level 1

I am trying the code athttp://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sdkHelp&file=convertPDFToPS.63.3.html

import java.io.File;

import java.io.FileInputStream;

import java.io.InputStream;

import java.io.FileNotFoundException;

import java.util.Properties;

 

import com.adobe.idp.Document;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;

import com.adobe.livecycle.convertpdfservice.client.ConvertPdfServiceClient;

import com.adobe.livecycle.convertpdfservice.client.enumeration.PSLevel;

 

public class JavaAPIConvertPDFtoPS

{

     public static void main(String[] args)

     {

          // Specify connection properties necessary to create a Distiller Service client

          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 instance
          ServiceClientFactory factory = ServiceClientFactory.createInstance(ConnectionProps);
 
          try
          {
               // Get a PDF file document to convert to a PS document and populate a com.adobe.idp.Document object
               String inputFileName = "C:\\test.pdf";
               FileInputStream fileInputStream = new FileInputStream(inputFileName);
               Document inDoc = new Document(fileInputStream);
 
               // Perform the conversion and get the newly created document
               Document createdDocument = new ConvertPdfServiceClient(factory).toPS(
                    inDoc,
                    PSLevel.LEVEL_3
               );
 
               // Save the file
               createdDocument.copyToFile(new File("C:\\test.ps"));
          }
          catch (Exception e)
          {
               System.out.println("Error OCCURRED: " + e.getMessage());
          }
 
     }
 
}
 

This code is client code.  Is there an equivalent server side code, where there is no need to make any server connection?

2 Replies

Avatar

Level 8

Not sure what you mean by saying that this code is client side code.

The code makes an EJB connection to the LiveCycle server which executes the toPS command server side and then returns it to the requester.

Avatar

Level 1

I am curious to know if there is code that converts PDF to Postscript without going through an EJB.  In other words you need to have a server running to do the conversion.  Can it be done without the server?