When drawing views into the PrintedPdfDocument canvas, the size in bytes of the PDF can noticeably increase, especially when the view contains bitmaps (e.g. ImageView).
One way to reduce the final size should be the resolution field in PrintAttributes, example:
PrintAttributes printAttrs = new PrintAttributes.Builder().
setColorMode(PrintAttributes.COLOR_MODE_COLOR).
setMediaSize(PrintAttributes.MediaSize.ISO_A4).
setResolution(new Resolution("zooey", PRINT_SERVICE,hDpi,vDpi)).
setMinMargins(Margins.NO_MARGINS).
build();
PdfDocument document = new PrintedPdfDocument(this, printAttrs);
However, whatever I choose as hDpi and vDpi the PDF final size does not change at all.
Am I doing something wrong? How can I reduce the PDF size?
Best solution for this use pixles instead of dp and sp for designing the view for PDF generation