1 Reply Latest reply on Aug 21, 2008 7:52 AM by Jasmin Charbonneau

    How to render PDF from Local File System

    Level 1
      Hi,
      Our code to render PDF form is as follows
      __________________________________________________________________________________________ __________________________________________
      Properties connectionProps = new Properties();
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "http:\\end point url");
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceC lientFactoryProperties.DSC_SOAP_PROTOCOL);
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "WebSphere");
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "admin");
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

      ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
      FormsServiceClient formsClient = new FormsServiceClient(myFactory);

      String formName = "/ManualGEAC.pdf";
      byte[] cData = "".getBytes();

      Document oInputData = new Document(cData);
      PDFFormRenderSpec pdfFormRenderSpec = new PDFFormRenderSpec();
      pdfFormRenderSpec.setCacheEnabled(new Boolean(true));
      URLSpec uriValues = new URLSpec();

      uriValues.setContentRootURI("http://10.145.86.201:9080/PANBaseApp/forms");

      FormsResult formOut = formsClient.renderPDFForm(
      formName, //formQuery
      oInputData, //inDataDoc
      pdfFormRenderSpec, //PDFFormRenderSpec
      uriValues, //urlSpec
      null //attachments

      Document myData = formOut.getOutputContent();
      __________________________________________________________________________________________ ___

      In the above snippet the setting of ContentRootUrl is not working. At the given line :
      __________________________________________________________________________________________ ___
      uriValues.setContentRootURI("http://10.145.86.201:9080/PANBaseApp/forms");
      __________________________________________________________________________________________ ___

      Can anybody help me to set the content root url as the local file path of the Pdf form.

      Thanks,
      Saravanan