cancel
Showing results for 
Search instead for 
Did you mean: 

PDF to XML conversion

shabbir_mohmad
Participant
0 Kudos

Hi ,

Is there any way to convert pdf document to xml in SAP PI.

I have checked SCN for suggesion and found one java mapping code which actually writes all the data of pdf (not in sequence.. means sometimes writing middle column first and sometimes last column first etc.. ) to xml file in a single string not as xml tags.

My example pdf is attached here.

Ex output:

-----------

<?xml version="1.0" encoding="UTF-8"?>

-<ns0:MT_PDF2XML xmlns:ns0="http://pdf2xml">

<Record>Page 1 Purchase order ABC Enterprises ABC Road Alpine Number: Date: Delivery date: 4500005693 03/02/2001 07/02/2001 NumberArticleDescriptionPriceQuantityTaxAmount00010R-5000ABC red 250 gr10.0111.016 1110.0 00011R-3456ABC magic 500 gr1000.01.016 1000.0Tax: Total: 337.6 2447.6 </Record>

</ns0:MT_PDF2XML>

---------------

I can take data from here and use substring function to get appropriate outout, but is there a way to get the tags and values in that tags.

Expected output:

-----------

<?xml version="1.0" encoding="UTF-8"?>

-<ns0:MT_PDF2XML xmlns:ns0="http://pdf2xml">

<Name>Purchase Order</Name>

<Address>ABC enterprises,ABC Road, Alpine</Address>

<Number>450005693</Number>

<Date>03/02/2001</Date>

<DeliveryDate>07/02/2001</DeliveryDate>

etc etc

Regards,

SP

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member183249
Active Participant
0 Kudos

Hi SP,

Better use some service from other Vendors like Ephisoft else you need to templatize your PO document and directly parse to XML using position. Any Java Program won't help you.

If you want you can use Tesseract Library for your Java Coding. But you will face lot of Challenges.

Regards,

Rahul

nabendu_sen
Active Contributor
0 Kudos

Hi SP,

In Java, there are couple of Library / API's available to convert PDF to XML like 'pdf2htmlEX'.

More information : Accessing File Formats (Wiki forum at Coderanch)

You can also check the Code mentioned in the below blog:

http://stackoverflow.com/questions/16936013/java-code-for-pdf-to-xml-conversion

Regards,

Nabendu.

former_member186851
Active Contributor
0 Kudos

Hello SP,

Guess you can do it in the java mapping

Check the below discussion