[ 
https://issues.apache.org/jira/browse/PDFBOX-3134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15029278#comment-15029278
 ] 

Raymond Cabrera commented on PDFBOX-3134:
-----------------------------------------

Hope this helps:

 public String getText( byte[] contents ) throws UnableExtractException {
        String textString = "";
        PDDocument pd = null;
        try {
            PDFTextStripper stripper = new PDFTextStripper();
            pd = parseDocument(contents);
            textString = stripper.getText(pd);
        }
        catch( Exception ie ) {
            throw new UnableExtractException( ie.getMessage() );
        } finally {
            if (pd != null) {
                try {
                    pd.close();
                } catch (Exception e) {
                }
            }
        }

        return textString;
    }
    
    private PDDocument parseDocument( byte[] contents ) throws 
java.io.IOException {
        PDFParser parser = new PDFParser( getInputStream(contents) );
        parser.parse();
        return new PDDocument( parser.getDocument() );
    }




> 'Certain' PDF Extraction issue on double letters (i.e. 'ss' ) - drops second 
> letter
> -----------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3134
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3134
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>            Reporter: Raymond Cabrera
>         Attachments: Anton Legore Engineering Resume.pdf, PDFBOX-3134.txt
>
>
> Hi there,
> We have users that are uploading certain PDF files (only happens on some) and 
> when the system extracts the text, when there is a double letter word like 
> 'Mississauga', it comes up as Misisauga - removes the double letter.  This 
> seem to only occur on some PDFs.  Also, issue is not present when using the 
> original Word file.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to