/** * This will initialize and process the contents of the stream. * * @param page the page to process * @throws IOException if there is an error accessing the stream */ public void processPage(PDPage page) throws IOException { initPage(page); if (page.hasContents()) { isProcessingPage = true; processStream(page); isProcessingPage = false; } }
/** * Process the page to extract the region text. * * @param page The page to extract the regions from. * @throws IOException If there is an error while extracting text. */ public void extractRegions( PDPage page ) throws IOException { for (String region : regions) { setStartPage(getCurrentPageNo()); setEndPage(getCurrentPageNo()); //reset the stored text for the region so this class //can be reused. String regionName = region; ArrayList<List<TextPosition>> regionCharactersByArticle = new ArrayList<>(); regionCharactersByArticle.add( new ArrayList<TextPosition>() ); regionCharacterList.put( regionName, regionCharactersByArticle ); regionText.put( regionName, new StringWriter() ); } if( page.hasContents() ) { processPage( page ); } }
/** * Process the validation of a PageContent (The page is initialized by the constructor) * * @throws ValidationException */ public void validatePageContentStream() throws ValidationException { try { if (processedPage.hasContents()) { processPage(processedPage); } } catch (ContentStreamException e) { context.addValidationError(new ValidationError(e.getErrorCode(), e.getMessage())); } catch (IOException e) { throw new ValidationException("Unable to check the Page ContentStream : " + e.getMessage(), e); } }
if (!appendContent.isOverwrite() && sourcePage.hasContents()) if (sourcePage.hasContents())
if (page.hasContents())
/** * This will initialise and process the contents of the stream. * * @param page the page to process * @throws IOException if there is an error accessing the stream * @throws PdfTimeoutException when parging pdf timeout */ public void processPage(PDPage page) throws IOException, PdfTimeoutException { initPage(page); if (page.hasContents()) { isProcessingPage = true; processStream(page); isProcessingPage = false; } }
/** * This will initialize and process the contents of the stream. * * @param page the page to process * @throws IOException if there is an error accessing the stream */ public void processPage(PDPage page) throws IOException { initPage(page); if (page.hasContents()) { isProcessingPage = true; processStream(page); isProcessingPage = false; } }
/** * This will process all of the pages and the text that is in them. * * @param pages * The pages object in the document. * * @throws IOException * If there is an error parsing the text. */ protected void processPages(PDPageTree pages) throws IOException { maxPage = pages.getCount(); for (PDPage page : pages) { currentPageNo++; if (page.hasContents()) { processPage(page); } } }
/** * Process the page to extract the region text. * * @param page The page to extract the regions from. * @throws IOException If there is an error while extracting text. */ public void extractRegions( PDPage page ) throws IOException { for (String region : regions) { setStartPage(getCurrentPageNo()); setEndPage(getCurrentPageNo()); //reset the stored text for the region so this class //can be reused. String regionName = region; ArrayList<List<TextPosition>> regionCharactersByArticle = new ArrayList<List<TextPosition>>(); regionCharactersByArticle.add( new ArrayList<TextPosition>() ); regionCharacterList.put( regionName, regionCharactersByArticle ); regionText.put( regionName, new StringWriter() ); } if( page.hasContents() ) { processPage( page ); } }
/** * Process the page to extract the region text. * * @param page The page to extract the regions from. * @throws IOException If there is an error while extracting text. */ public void extractRegions( PDPage page ) throws IOException { for (String region : regions) { setStartPage(getCurrentPageNo()); setEndPage(getCurrentPageNo()); //reset the stored text for the region so this class //can be reused. String regionName = region; ArrayList<List<TextPosition>> regionCharactersByArticle = new ArrayList<>(); regionCharactersByArticle.add( new ArrayList<TextPosition>() ); regionCharacterList.put( regionName, regionCharactersByArticle ); regionText.put( regionName, new StringWriter() ); } if( page.hasContents() ) { try { processPage( page ); } catch (final PdfTimeoutException e) { } } }
/** * Process the validation of a PageContent (The page is initialized by the constructor) * * @throws ValidationException */ public void validatePageContentStream() throws ValidationException { try { if (processedPage.hasContents()) { processPage(processedPage); } } catch (ContentStreamException e) { context.addValidationError(new ValidationError(e.getErrorCode(), e.getMessage())); } catch (IOException e) { throw new ValidationException("Unable to check the Page ContentStream : " + e.getMessage(), e); } }
/** * Process the validation of a PageContent (The page is initialized by the constructor) * * @throws ValidationException */ public void validatePageContentStream() throws ValidationException { try { if (processedPage.hasContents()) { processPage(processedPage); } } catch (final PdfTimeoutException e) { } catch (ContentStreamException e) { context.addValidationError(new ValidationError(e.getErrorCode(), e.getMessage())); } catch (IOException e) { throw new ValidationException("Unable to check the Page ContentStream : " + e.getMessage(), e); } }
if (page.hasContents())
if (page.hasContents())
if (!appendContent.isOverwrite() && sourcePage.hasContents()) if (sourcePage.hasContents())
if (!appendContent.isOverwrite() && sourcePage.hasContents()) if (sourcePage.hasContents())