"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java" between
pdfbox-2.0.23-src.zip and pdfbox-2.0.24-src.zip

About: Apache PDFBox is a Java PDF library tool that allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents.

PDFPageable.java  (pdfbox-2.0.23-src):PDFPageable.java  (pdfbox-2.0.24-src)
skipping to change at line 37 skipping to change at line 37
import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.common.PDRectangle;
/** /**
* Prints a PDF document using its original paper size. * Prints a PDF document using its original paper size.
* *
* @author John Hewson * @author John Hewson
*/ */
public final class PDFPageable extends Book public final class PDFPageable extends Book
{ {
private final PDDocument document; private final PDDocument document;
private final int numberOfPages;
private final boolean showPageBorder; private final boolean showPageBorder;
private final float dpi; private final float dpi;
private final Orientation orientation; private final Orientation orientation;
private boolean subsamplingAllowed = false; private boolean subsamplingAllowed = false;
private RenderingHints renderingHints = null; private RenderingHints renderingHints = null;
/** /**
* Creates a new PDFPageable. * Creates a new PDFPageable.
* *
* @param document the document to print * @param document the document to print
skipping to change at line 93 skipping to change at line 94
* @param showPageBorder true if page borders are to be printed * @param showPageBorder true if page borders are to be printed
* @param dpi if non-zero then the image will be rasterized at the given DPI * @param dpi if non-zero then the image will be rasterized at the given DPI
*/ */
public PDFPageable(PDDocument document, Orientation orientation, boolean sho wPageBorder, public PDFPageable(PDDocument document, Orientation orientation, boolean sho wPageBorder,
float dpi) float dpi)
{ {
this.document = document; this.document = document;
this.orientation = orientation; this.orientation = orientation;
this.showPageBorder = showPageBorder; this.showPageBorder = showPageBorder;
this.dpi = dpi; this.dpi = dpi;
numberOfPages = document.getNumberOfPages();
} }
/** /**
* Get the rendering hints. * Get the rendering hints.
* *
* @return the rendering hints or null if none are set. * @return the rendering hints or null if none are set.
*/ */
public RenderingHints getRenderingHints() public RenderingHints getRenderingHints()
{ {
return renderingHints; return renderingHints;
skipping to change at line 148 skipping to change at line 150
* @param subsamplingAllowed The new value indicating if subsampling is allo wed. * @param subsamplingAllowed The new value indicating if subsampling is allo wed.
*/ */
public void setSubsamplingAllowed(boolean subsamplingAllowed) public void setSubsamplingAllowed(boolean subsamplingAllowed)
{ {
this.subsamplingAllowed = subsamplingAllowed; this.subsamplingAllowed = subsamplingAllowed;
} }
@Override @Override
public int getNumberOfPages() public int getNumberOfPages()
{ {
return document.getNumberOfPages(); return numberOfPages;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* Returns the actual physical size of the pages in the PDF file. May not fi t the local printer. * Returns the actual physical size of the pages in the PDF file. May not fi t the local printer.
*/ */
@Override @Override
public PageFormat getPageFormat(int pageIndex) public PageFormat getPageFormat(int pageIndex)
{ {
skipping to change at line 214 skipping to change at line 216
default: default:
break; break;
} }
return format; return format;
} }
@Override @Override
public Printable getPrintable(int i) public Printable getPrintable(int i)
{ {
if (i >= getNumberOfPages()) if (i >= numberOfPages)
{ {
throw new IndexOutOfBoundsException(i + " >= " + getNumberOfPages()) ; throw new IndexOutOfBoundsException(i + " >= " + numberOfPages);
} }
PDFPrintable printable = new PDFPrintable(document, Scaling.ACTUAL_SIZE, showPageBorder, dpi); PDFPrintable printable = new PDFPrintable(document, Scaling.ACTUAL_SIZE, showPageBorder, dpi);
printable.setSubsamplingAllowed(subsamplingAllowed); printable.setSubsamplingAllowed(subsamplingAllowed);
printable.setRenderingHints(renderingHints); printable.setRenderingHints(renderingHints);
return printable; return printable;
} }
} }
 End of changes. 5 change blocks. 
3 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)