cancel
Showing results for 
Search instead for 
Did you mean: 

convert PDF file attachment to txt format ?

shashi_patan
Active Participant
0 Kudos

I am getting an pdf file but want to convert it into text attachment . is it possible to do it using module beans ? if yes how ?

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member190293
Active Contributor

Hi Shashi!

You could start trying with iText library:

import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.parser.PdfTextExtractor;

try {
PdfReader reader = new PdfReader(INPUTFILE);
int n = reader.getNumberOfPages();
String str=PdfTextExtractor.getTextFromPage(reader, 2); //Extracting the content from a particular page.
System.out.println(str);
reader.close();
}
catch (Exception e) {
System.out.println(e);
}

Regards, Evgeniy.

shashi_patan
Active Participant
0 Kudos

Sender is proxy from BI system. Also i need to do look up from ecc system.

Actually i am new in java so don't know much on it . I tried to find any link for end to end scenario but unable to get so. Any link for this requirement could have been serve my purpose.

shashi_patan
Active Participant
0 Kudos

Thank you so much.

Can you also provide me some java mapping code which can convert input payload to text file and send it as an attachment to mail server.

Actually PI itself is converting input payload to PDF using java mapping, now the requirement is changed and they want rather Text file than pdf.

manoj_khavatkopp
Active Contributor
0 Kudos

Use any parser to convert the incoming XML payload to txt file then add it as Attachment for output payload using OutputAttachment class.

Bdw what is your sender system / sender adapter ?

Br,

Manoj