Android PdfDocument.Page - Problems with image size

前端 未结 4 1329
闹比i
闹比i 2021-02-14 17:50

I am experiencing problems with images being larger when drawing onto a PdfDocument.Page. The app is targeted for a device running Android 4.4.4 (API level 19).

I am gen

4条回答
  •  天涯浪人
    2021-02-14 18:24

    The exact solution is to set the Canvas' density to 72 (But why?)

    • logo.setDensity(dpi); (calc dpi from desired image dimensions in pt and bitmap size)
    • canvas.setDensity(72);
    • canvas.drawBitmap(logo, ....);

提交回复
热议问题