Reputation: 103
I have PDF document with many pages 595x420 ppi but I need this pages push in 595x210 but all text must be visible.
So.. Can I change scale of PDF pages unproportionally (no zoom) to fit custom size of page with ghostscript or I must to use some another program?
Upvotes: 0
Views: 327
Reputation: 31139
If you want scaling applied to one axis and not the other, then you will have to do some PostScript programming. In /ghostpdl/Resource/Init/pdf_main.ps is the code which calculates the matrix required:
/pdf_PDF2PS_matrix { % <pdfpagedict> -- matrix
matrix currentmatrix matrix setmatrix exch
% stack: savedCTM <pdfpagedict>
dup get_any_box
% stack: savedCTM <pdfpagedict> /Trim|Crop|Art|MediaBox <Trim|Crop|Art|Media Box>
oforce_elems normrect_elems fix_empty_rect_elems 4 array astore
//systemdict /PDFFitPage known {
PDFDEBUG { (Fiting PDF to imageable area of the page.) = flush } if
That code calculates the x and y scale values and makes them the same. If you want them to differ, that's what you will have to modify. Note you will also have to set a specific media size using -dDEVICEHEIGHTPOINTS
and -dDEVICEWIDTHPOINTS
and set -dFIXEDMEDIA
to prevent the PDF file resizing the media.
Upvotes: 2