5 Replies Latest reply on Nov 8, 2007 6:45 PM by Jasmin Charbonneau

    Trying to save the data from the pdf into XML

    Level 1
      I have Adobe Live Cycle 8.0 installed and without the blade for Reader Extension.
      The objective is to save the editable data from the pdf into a XML file
      the code for that is:
      // to fetch the input pdf file from the local drive
      FileInputStream fileInputStream2 = new FileInputStream("C:\\Adobe-Final PDF\\stitched_Letters.pdf");
      Document inPDF = new Document(fileInputStream2);
      Properties connectionProps=new Properties();
      connectionProps.load(new FileInputStream(_propertiesPath));
      //propertiesPath is the path of the properties file
      ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
      FormDataIntegrationClient dataClient = new FormDataIntegrationClient(myFactory);
      Document resultPDF=dataClient.exportData(inPDF);

      What happens is that this ultimate resultPDF does not get the XML with data but rather with empty tags. Does this require Reader Extension?
        • 1. Re: Trying to save the data from the pdf into XML
          Jasmin Charbonneau Level 4
          You only need Reader Extension to have the ability to save the data in your PDF if you are using Reader.

          If the data is already in the PDF, then the FormDataIntegration service should be able to export it.

          How do you create and enter the data in your PDF?

          JAsmin
          • 2. Re: Trying to save the data from the pdf into XML
            Level 1
            Thanks Jasmin,

            Actually the pdf is designed using the Live Cycle Designer and it has many fill in fields.
            The objective is not to save the pdf with the data in local file system rather get the data that was filled in a XML file and store the XML in the content server.

            You must be refering to FormDataIntegrationClient API and thats what we have used but what it does is takes the pdf and flattens it but the formed XML has empty tags and data is not populated into it.

            Does this activity also need Reader Extension
            • 3. Re: Trying to save the data from the pdf into XML
              Jasmin Charbonneau Level 4
              The FormDataIntegration doesn't need Reader Extension.

              Reader Extension is only needed for the Reader users so they can do more than just view the PDF.

              If you just fill-in the form and submit, you should be fine without Reader Extension.

              Jasmin
              • 4. Re: Trying to save the data from the pdf into XML
                Level 1
                Well thanks but this code doesnot seem to work ot. do you have any running code that does this activity. Thanks a lot for your help
                • 5. Re: Trying to save the data from the pdf into XML
                  Jasmin Charbonneau Level 4
                  //Set connection properties required to invoke LiveCycle ES
                  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 FormDataIntegrationClient object
                  FormDataIntegrationClient dataClient = new FormDataIntegrationClient(myFactory);

                  //Reference a PDF form from which to export data
                  FileInputStream fileInputStream2 = new FileInputStream("C:\\Adobe\\Loan.pdf");

                  Document inputPDF = new Document(fileInputStream2);

                  //Export data from the form
                  Document resultPDF = dataClient.exportData(inputPDF);

                  //Save the exported form data as an XML file
                  File resultFile = new File("C:\\Adobe\\formData.xml");

                  resultPDF.copyToFile(resultFile);

                  }catch (Exception e) {
                  e.printStackTrace();
                  }
                  }

                  }