@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof ExtractByOutlineParameters)) { return false; } ExtractByOutlineParameters parameter = (ExtractByOutlineParameters) other; return new EqualsBuilder().appendSuper(super.equals(other)) .append(optimizationPolicy, parameter.optimizationPolicy) .append(discardOutline, parameter.discardOutline).append(level, parameter.getLevel()) .append(matchingTitleRegEx, parameter.getMatchingTitleRegEx()) .append(includePageAfter, parameter.isIncludePageAfter()) .isEquals(); } }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof ExtractByOutlineParameters)) { return false; } ExtractByOutlineParameters parameter = (ExtractByOutlineParameters) other; return new EqualsBuilder().appendSuper(super.equals(other)) .append(optimizationPolicy, parameter.optimizationPolicy) .append(discardOutline, parameter.discardOutline).append(level, parameter.getLevel()) .append(matchingTitleRegEx, parameter.getMatchingTitleRegEx()) .append(includePageAfter, parameter.isIncludePageAfter()) .isEquals(); } }
@Override public void execute(ExtractByOutlineParameters parameters) throws TaskException { for(PdfSource<?> source: parameters.getSourceList()) { LOG.debug("Opening {} ", source); document = source.open(documentLoader).getUnderlyingPDDocument(); LOG.debug("Retrieving outline information for level {} and match regex {}", parameters.getLevel(), parameters.getMatchingTitleRegEx()); OutlineExtractPageDestinations pagesDestination = new SamboxOutlineLevelsHandler(document, parameters.getMatchingTitleRegEx()).getExtractPageDestinations(parameters.getLevel(), parameters.isIncludePageAfter()); LOG.debug("Starting extraction by outline, level {} and match regex {}", parameters.getLevel(), parameters.getMatchingTitleRegEx()); new PageDestinationsLevelPdfExtractor(document, parameters, pagesDestination, source) .extract(executionContext()); nullSafeCloseQuietly(document); } LOG.debug("Extraction completed and outputs written to {}", parameters.getOutput()); }
@Override public void execute(ExtractByOutlineParameters parameters) throws TaskException { for(PdfSource<?> source: parameters.getSourceList()) { LOG.debug("Opening {} ", source); document = source.open(documentLoader).getUnderlyingPDDocument(); LOG.debug("Retrieving outline information for level {} and match regex {}", parameters.getLevel(), parameters.getMatchingTitleRegEx()); OutlineExtractPageDestinations pagesDestination = new SamboxOutlineLevelsHandler(document, parameters.getMatchingTitleRegEx()).getExtractPageDestinations(parameters.getLevel(), parameters.isIncludePageAfter()); LOG.debug("Starting extraction by outline, level {} and match regex {}", parameters.getLevel(), parameters.getMatchingTitleRegEx()); new PageDestinationsLevelPdfExtractor(document, parameters, pagesDestination, source) .extract(executionContext()); nullSafeCloseQuietly(document); } LOG.debug("Extraction completed and outputs written to {}", parameters.getOutput()); }
@Test public void bookmarksLevel_Specified() { ExtractByOutlineParameters parameters = defaultCommandLine().with("-l", "3").invokeSejdaConsole(); assertEquals(3, parameters.getLevel()); }