pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tres Finocchiaro <tres.finocchi...@gmail.com>
Subject Scaled and rasterized, undesired margins
Date Wed, 30 Mar 2016 16:08:53 GMT
The code says it all...

To summarize: If we SCALE_TO_FIT and provide custom margins, we get very
strange output.

Before filing a bug, I wanted to make sure we're using the library


public static void main(String[] args) throws Exception {
    PDDocument pdf = PDDocument.load(new URL(args[0]).openStream());
    PrinterJob job = PrinterJob.getPrinterJob();

    Paper paper = new Paper();
    paper.setSize(612, 792); //8.5 x 11 in
    paper.setImageableArea(72, 72, 468, 648); //1 inch margins

    PageFormat page = job.getPageFormat(null);

    //Vector print - works as expected, margins applied and scaled properly
    job.setPrintable(new PDFPrintable(pdf, Scaling.SCALE_TO_FIT,
false, 0, false), page);

    //Unscaled raster print - works as expected, margins applied and
document cut off
    job.setPrintable(new PDFPrintable(pdf, Scaling.ACTUAL_SIZE, false,
72, false), page);

    //Scaled raster print - unexpected results, same scale as vector
print, but same cut off as unscaled raster print
    job.setPrintable(new PDFPrintable(pdf, Scaling.SCALE_TO_FIT,
false, 72, false), page);


- Tres.Finocchiaro@gmail.com

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message