开发者

How to generate a PDF using android drawing commands?

I have an android program which draws lines and text to a canvas. (These are all vector drawing operations.) Does anyone have any advice for exporting that canvas to a PDF? I've looked into changing the Bitmap.CompressFormat that the canvas is based upon, hoping there'd be a PDF (or some sort of vector) format, but no luck there.

My goal is to output some sort of Vector file suitable for p开发者_JAVA百科rinting.

I'd appreciate any advice. Thanks!


There is nothing in Android for this. You can take a shot at seeing if somebody has a PDF library for Java (e.g., iText) working on Android, but these libraries may be large.

A better solution may be for you to save in something simpler (e.g., SVG, an XML format) and have your server convert that to PDF or anything else desired.


That was very long ago. If anybody happens to find this question nowadays, Android has it since KitKat: PrintedPdfDocument.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜