Skip to Content

convert PDF file attachment to txt format ?

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 ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 18, 2017 at 02:57 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 19, 2017 at 04:41 AM

    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.

    Add comment
    10|10000 characters needed 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

  • Jan 21, 2017 at 05:17 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded