You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Tres Finocchiaro <tr...@gmail.com> on 2016/04/04 15:58:59 UTC
Re: Scaled and rasterized, undesired margins
Bug report filed:
- Tres.Finocchiaro@gmail.com
On Wed, Mar 30, 2016 at 12:08 PM, Tres Finocchiaro <
tres.finocchiaro@gmail.com> wrote:
> 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
> correctly.
>
> https://gist.github.com/tresf/e6220b0880974df61ee41861c9e7193c
>
>
> 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);
> page.setPaper(paper);
>
> //Vector print - works as expected, margins applied and scaled properly
> job.setPrintable(new PDFPrintable(pdf, Scaling.SCALE_TO_FIT, false, 0, false), page);
> job.print();
>
> //Unscaled raster print - works as expected, margins applied and document cut off
> job.setPrintable(new PDFPrintable(pdf, Scaling.ACTUAL_SIZE, false, 72, false), page);
> job.print();
>
> //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);
> job.print();
>
> pdf.close();
> }
>
>
>
> - Tres.Finocchiaro@gmail.com
>
Re: Scaled and rasterized, undesired margins
Posted by Tres Finocchiaro <tr...@gmail.com>.
https://issues.apache.org/jira/browse/PDFBOX-3306
- Tres.Finocchiaro@gmail.com
On Mon, Apr 4, 2016 at 9:58 AM, Tres Finocchiaro <tres.finocchiaro@gmail.com
> wrote:
> Bug report filed:
>
>
> - Tres.Finocchiaro@gmail.com
>
> On Wed, Mar 30, 2016 at 12:08 PM, Tres Finocchiaro <
> tres.finocchiaro@gmail.com> wrote:
>
>> 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
>> correctly.
>>
>> https://gist.github.com/tresf/e6220b0880974df61ee41861c9e7193c
>>
>>
>> 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);
>> page.setPaper(paper);
>>
>> //Vector print - works as expected, margins applied and scaled properly
>> job.setPrintable(new PDFPrintable(pdf, Scaling.SCALE_TO_FIT, false, 0, false), page);
>> job.print();
>>
>> //Unscaled raster print - works as expected, margins applied and document cut off
>> job.setPrintable(new PDFPrintable(pdf, Scaling.ACTUAL_SIZE, false, 72, false), page);
>> job.print();
>>
>> //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);
>> job.print();
>>
>> pdf.close();
>> }
>>
>>
>>
>> - Tres.Finocchiaro@gmail.com
>>
>
>