Is there a way to prevent the Android printing platform from rescaling the PDF when printing, as is the case with the Google Cloud Printer โNo Fittingโ?
I am writing an application that includes the ability to print a PDF file. The user has the ability to print through the web interface of Google Cloud Print or (at 4.4+) through the base print service environment for Android. For the latter, I use the approach described here , which writes the raw PDF file directly to the file descriptor provided by the print environment. Both print options work fine.
However, when I use Cloud Print, I can specify the โNo Fittingโ option, which causes the PDF to print as is, without any forced margins or scaling. I was not able to find a way to replicate this using the Android embedded environment - despite setting the layout to NO_MARGINS, the result is always a printout that has been reduced compared to a copy of Cloud Print. Here are the print attributes that I used:
PrintAttributes attribs = new PrintAttributes.Builder() .setMediaSize(PrintAttributes.MediaSize.ISO_A4.asLandscape()) .setMinMargins(PrintAttributes.Margins.NO_MARGINS) .setColorMode(PrintAttributes.COLOR_MODE_MONOCHROME) .build();
Has anyone encountered this problem before? How did you resolve it?
Thanks!
source share