Quantcast
Channel: Adobe Community : Popular Discussions - LiveCycle PDF Generator
Viewing all articles
Browse latest Browse all 31905

Problem with converting html to pdf using LiveCycle ES Java API

$
0
0

I am using this code to convert html to pdf.

 

/*

 

* 1. adobe-generatepdf-client.jar

 

* 2. adobe-livecycle-client.jar

 

* 3. adobe-usermanager-client.jar

 

* 4. adobe-utilities.jar

 

* 5. wlclient.jar

 

*/

 

import java.io.File;

 

import java.util.Properties;

 

import com.adobe.idp.Document;

 

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

 

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

 

import com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient;

 

import com.adobe.livecycle.generatepdf.client.HtmlToPdfResult;

 

public class ConvertHTML {

 

   public static void main(String[] args)

 

    {

 

        try{

 

        //Set connection properties required to invoke LiveCycle ES                             

 

        Properties connectionProps = new Properties();

 

        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAUL T_EJB_ENDPOINT, "t3://localhost:7001");

 

        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSP ORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);       

 

        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER _TYPE, "WebLogic");

 

        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDEN TIAL_USERNAME, "administrator");

 

        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDEN TIAL_PASSWORD, "password");

 

       
        //Create a ServiceClientFactory instance

 

        ServiceClientFactory factory = ServiceClientFactory.createInstance(connectionProps);

 

          //Create a GeneratePdfServiceClient object

 

        GeneratePdfServiceClient pdfGenClient = new GeneratePdfServiceClient(factory);

 

       //Get an HTML document to convert to a PDF document a

 

        String inputFileName = "http://www.adobe.com";
        //String inputFileName = "C:\\Documents and Settings\\venkat\\Desktop\\Adobe.htm";

 

        String securitySettings = "No Security";

 

        String fileTypeSettings = "Standard";

 

System.out.println("one");

 

        //Convert HTML content to a PDF document

 

        HtmlToPdfResult result = pdfGenClient.htmlToPDF2(inputFileName, fileTypeSettings, securitySettings, null, null);
System.out.println("two");         

 

        //Get the newly created document

 

        Document createdDocument = result.getCreatedDocument();

 

        //Save the PDF document as a PDF file

 

        createdDocument.copyToFile(new File("C:\\test.pdf"));

 

    }

 

    catch (Exception e) {

 

        System.out.println("Error OCCURRED: " + e.getMessage());
        e.printStackTrace();

 

    }

 

}

 

}

 

 

 

I can able to compile this class but while running i am getting error like below.

Error OCCURRED: Internal error.
ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
        at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.doSend(EjbMe ssageDispatcher.java
:160)
        at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(A bstractMessageDispat
cher.java:57)
        at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:2 08)
        at com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient.htmlT oPDF2(GeneratePdfSer
viceClient.java:666)
        at ConvertHTML.main(ConvertHTML.java:84)
Caused by: java.rmi.RemoteException: Remote EJBObject lookup failed for 'ejb/Invocation'; nested exc
eption is:
        org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 203  completed: No
        at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(E jbMessageDispatcher.
java:101)
        at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.doSend(EjbMe ssageDispatcher.java
:130)
        ... 4 more
Caused by: org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 203  completed: No
        at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(U nknown Source)
        at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(U nknown Source)
        at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.writeLo ck(Unknown Source)
        at com.sun.corba.se.impl.encoding.BufferManagerWriteStream.sendFragment( Unknown Source)
        at com.sun.corba.se.impl.encoding.BufferManagerWriteStream.sendMessage(U nknown Source)
        at com.sun.corba.se.impl.encoding.CDROutputObject.finishSendingMessage(U nknown Source)
        at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.finishSending Request(Unknown Sour
ce)
        at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marsh alingComplete1(Unkno
wn Source)
        at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marsh alingComplete(Unknow
n Source)
        at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source)
        at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.is_a(Unknown Source)
        at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
        at weblogic.corba.j2ee.naming.Utils.narrowContext(Utils.java:126)
        at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContex t(InitialContextFact
oryImpl.java:94)
        at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContex t(InitialContextFact
oryImpl.java:31)
        at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont extFactory.java:41)
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
        at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initJndiCont ext(EjbMessageDispat
cher.java:213)
        at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.getJndiConte xt(EjbMessageDispatc
her.java:226)
        at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(E jbMessageDispatcher.
java:87)
        ... 5 more

 

 

 

 

can u plz give me some way to do the convertion.


Viewing all articles
Browse latest Browse all 31905

Trending Articles