pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Strein, Mark C CIV USARMY TRADOC ANALYSIS CTR (US)" <mark.c.strein....@mail.mil>
Subject RE: How to find the position of a specific paragraph in the input PDF? (UNCLASSIFIED)
Date Mon, 04 Aug 2014 11:22:24 GMT
Classification: UNCLASSIFIED
Caveats: NONE

Morning Sir,
The basic construct for extracting the value in a field is:

) - note: I use fully qualified names(FQN) to prevent errors

My way of extracting the FQN is as follows(the short version):

private void processField(PDField field,boolean buildPDList) throws
            List kids = field.getKids();
            if(kids != null)
                Iterator kidsIter = kids.iterator();
                    Object pdfObj = kidsIter.next();
                    if(pdfObj instanceof PDField)
                        PDField kid = (PDField)pdfObj;
				//other processing

Hope that helps.

Mark Strein

-----Original Message-----
From: Amir H. Jadidinejad [mailto:amir.jadidi@yahoo.com.INVALID] 
Sent: Sunday, August 03, 2014 8:53 PM
To: user pdfbox
Subject: How to find the position of a specific paragraph in the input PDF?

I'm going to extract the content of a PDF file using PDFBox library. The
content should be processed paragraph-by-paragraph and for each paragraph, I
need its position for follow-up processing. Using the following code, I can
extract the whole content of an input PDF:

PDDocument doc = PDDocument.load(file);
PDFTextStripper stripper = new PDFTextStripper(); String txt =
stripper.getText(doc); doc.close();

I have two problems:

    1. I don't know how to extract the content paragraph by paragraph.
    2. I don't know how to store the position of a paragraph for follow-up
processing (for example highlighting and etc.)


Classification: UNCLASSIFIED
Caveats: NONE

View raw message