Bug 699968

Summary: Enhancement: documentation for pdf scaling
Product: Ghostscript Reporter: MarjaE <marja-e>
Component: DocumentationAssignee: Default assignee <ghostpdl-bugs>
Status: RESOLVED INVALID    
Severity: enhancement    
Priority: P4    
Version: 9.25   
Hardware: Macintosh   
OS: MacOS X   
Customer: Word Size: ---

Description MarjaE 2018-10-16 05:32:58 UTC
I think it would help to fit some of my pdfs to my e-reader, so pixels in raster images in the pdf match up with pixels on the screen. I am sure other users may also have reason to fit some of their pdfs to specific sizes.

If Ghostscript already has this capability, better documentation might help.

"How to use Ghostscript" explains that -dFIXEDMEDIA and -dFIXEDRESOLUTION crop the pdf, rather than resize it. So they aren't suitable. "How to use Ghostscript" doesn't explain whether -dFITPAGE, etc. resize it, or how they can be used. "How to use Ghostscript" doesn't discuss "-dPDFSETTINGS=/screen" etc., which appear in older Ghostscript scripts.
Comment 1 Ken Sharp 2018-10-16 07:19:04 UTC
(In reply to MarjaE from comment #0)
> I think it would help to fit some of my pdfs to my e-reader, so pixels in
> raster images in the pdf match up with pixels on the screen. I am sure other
> users may also have reason to fit some of their pdfs to specific sizes.

PDF files don't have a size in 'pixels'. All measurements in PDF files, including the media size, are in points where 1 point = 1/72 inch.

So there's no way to 'resize' a PDF file to pixels.

If you know the dimensions of the target device then you can create a scaled PDF very simply; -dDEVICEWIDTHPOINTS=x -dDEVICEHEIGHTPOINTS=y -dFIXEDMEDIA -dPDFitPage

However, this almost certainly won't mean that samples in images in the PDF file will 'match up' with the pixels in your screen. That's a hopeless goal.
Comment 2 MarjaE 2018-10-16 19:05:41 UTC
> If you know the dimensions of the target device then you can create a scaled PDF very simply; -dDEVICEWIDTHPOINTS=x -dDEVICEHEIGHTPOINTS=y -dFIXEDMEDIA -dPDFitPage

According to the documentation, -dFIXEDMEDIA creates a *cropped* pdf. If the documentation is wrong, then it would help to correct it.

-dPDFFitPage doesn't explain how to set the device page size.

And is -dPDFSETTINGS still used?

> However, this almost certainly won't mean that samples in images in the PDF file will 'match up' with the pixels in your screen. That's a hopeless goal.

k2pdfopt does that for scanned pdfs. Using the device settings there, which include pixel count, makes things *much* more readable than using default settings.