How to convert Android View to PDF

前端 未结 4 747
日久生厌
日久生厌 2020-12-10 12:21

I have created an Android Invoice app. The generated invoice is standard Android layout with nested views. I am looking for a library that I can use to convert this view to

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 13:02

    Without using a third-party library you can use PdfDocument which was introduced in Android API 19. However, keep in mind that the dimension of the pdf file will be in the postscript point(1/72 inch). Therefore, you have to convert your view's dimension to match the requirement before drawing to the canvas.

提交回复
热议问题