Community

How to get character wise output in XML using the sample JAVA code from the FineReader SDK? Answered

I get XML in this format when I used the Cloud OCR

<line baseline="481" l="228" t="429" r="559" b="493">

   <formatting lang="EnglishUnitedStates">

      <charParams l="228" t="433" r="256" b="480">E</charParams>

      <charParams l="263" t="444" r="296" b="493">q</charParams>

      <charParams l="305" t="445" r="337" b="481">u</charParams>

      <charParams l="345" t="430" r="356" b="480">i</charParams>

      <charParams l="360" t="436" r="383" b="481">t</charParams>

      <charParams l="386" t="445" r="420" b="493">y</charParams>

      <charParams l="421" t="430" r="441" b="493"> </charParams>

      <charParams l="442" t="430" r="453" b="480">i</charParams>

      <charParams l="462" t="444" r="493" b="480">n</charParams>

      <charParams l="498" t="429" r="521" b="480">f</charParams>

      <charParams l="524" t="444" r="559" b="481">o</charParams>

   </formatting>

</line>

But I get this when I used the FineReader offline SDK. I ran the sample code that was included while installing.

<line baseline="701" l="1040" t="670" r="2343" b="709">

   <formatting lang="EnglishUnitedStates">

      Have you ever think that your digital camera could successfully replace

   </formatting>

</line>

I want to get the result in the same format as the first result. What do I have to change from the code to get it in that manner?

Was this article helpful?

0 out of 0 found this helpful

Comments

1 comment

  • Avatar
    Helen Osetrova

    Hello, Ashyam!

    To get the .xml file in the desired format, please set the properties of the XMLExportParams object:

    FREngine.XMLExportParams XMLParams = engineLoader.Engine.CreateXMLExportParams();

    XMLParams.WriteCharAttributes = FREngine.XMLCharAttributesEnum.XCA_Basic;

    And then pass this object to the document.Export() method:

    document.Export( Path.Combine( FreConfig.GetSamplesFolder(), @"Demo.xml"), FREngine.FileExportFormatEnum.FEF_XML, XMLParams);

     

    Hope this information will be helpful!

    1

Please sign in to leave a comment.