Skip to content

Raster filter crops to ImageableArea, PDF filter fills blank to PaperDimension #666

@ValdikSS

Description

@ValdikSS

Describe the bug

I'm trying to print A4 page without borders, printer filter accepts cups-raster.
My printer is unable to print the top 4mm of the page, but otherwise prints the whole page without borders from left, right, and bottom.

To make print-scaling=fit skip the first 4mm of the page to print any A4 document to the whole imageable area, I've added the following to PPD generator:

// left bottom right top
HWMargins 0 0 0 4mm

pdftopdf (first filter when printing PDF) works as expected: it scales the content and fill the top with the blank space, preserving w×h and aspect ratio.

gstoraster (second filter), however, also processed the data, and instead of fitting the page by adding blank space on the top of the document, crops the document from the top (resulting in lower height, lower pixel count, different aspect ratio, non 210 × 297mm A4 document).

Example

Original document (A4 210 × 297mm, PDF):

Image

Here how it looks with HWMargins 0 0 0 25mm

cupsfilter … -m application/vnd.cups-*pdf* … -o print-scaling=fit input.pdf
resulting in proper A4 (210 × 297 mm) document with the blank space on top, this is exactly what I'm trying to achieve.

Image

But
cupsfilter … -m application/vnd.cups-*raster* … -o print-scaling=fit input.pdf
resulting in 4961 × 6425 pixel cups-raster data (210mm × 271 mm, not A4), with the top blank space cut out.

Image

Filter prints the document from top to bottom, which results in cropped 4mm from the top due to hardware limitation, with borders from left and right and large border from the bottom.

I also tried to use PNG image as input, which uses only imagetoraster / imagetopdf.
imagetopdf has exactly the same result, however imagetoraster also crops width as well, resulting in 4546×6425 pixel image (192 mm × 271 mm).

Data

Here's all the files:

hwmargin-issue.zip

Is my understanding of HWMargins / ImageableArea incorrect? How can I achieve 4mm padding for my raster printer?

Software

  • cups-filters-2.0.1-12.fc43.x86_64
  • libcupsfilters-2.1.1-5.fc43.x86_64

The same result on 1.x cups-filters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions