You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/02/05 08:55:26 UTC
svn commit: r1886225 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java
Author: tilman
Date: Fri Feb 5 08:55:26 2021
New Revision: 1886225
URL: http://svn.apache.org/viewvc?rev=1886225&view=rev
Log:
PDFBOX-5093: pass PDFRenderer, as suggested by Alexander Scherbatiy
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java?rev=1886225&r1=1886224&r2=1886225&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java Fri Feb 5 08:55:26 2021
@@ -112,8 +112,25 @@ public final class PDFPrintable implemen
public PDFPrintable(PDDocument document, Scaling scaling, boolean showPageBorder, float dpi,
boolean center)
{
+ this(document, scaling, showPageBorder, dpi, center, new PDFRenderer(document));
+ }
+
+ /**
+ * Creates a new PDFPrintable with the given page scaling and with optional page borders shown.
+ * The image will be rasterized at the given DPI before being sent to the printer.
+ *
+ * @param document the document to print
+ * @param scaling page scaling policy
+ * @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 center true if the content is to be centered on the page (otherwise top-left).
+ * @param renderer the document renderer. Useful if {@link PDFRenderer} has been subclassed.
+ */
+ public PDFPrintable(PDDocument document, Scaling scaling, boolean showPageBorder, float dpi,
+ boolean center, PDFRenderer renderer)
+ {
this.document = document;
- this.renderer = new PDFRenderer(document);
+ this.renderer = renderer;
this.scaling = scaling;
this.showPageBorder = showPageBorder;
this.dpi = dpi;