Skip to Content
0

convert PDF file attachment to txt format ?

Jan 18, 2017 at 01:08 PM

96

avatar image
Former Member

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 ?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Evgeniy Kolmakov Jan 18, 2017 at 02:57 PM
1

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 19, 2017 at 04:41 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
avatar image
Former Member Jan 21, 2017 at 05:17 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded