Open prompteus opened 7 years ago
@PhilJay Any update on this? This would be an incredibly useful feature, e.g. for including the plots from screen in generated pdf reports.
Just in case someone else is looking for solution to a similar problem, I found a work-around. Using android.graphics.pdf
, one can store the chart view as a vector-based format in pdf with
fun printView2PDF(content: View, outFile:File){
// create a new document
val document = PdfDocument();
// crate a page description
val pageInfo = PdfDocument.PageInfo.Builder(
content.measuredWidth, content.measuredHeight,1)
.create();
// start a page
val page = document.startPage(pageInfo);
// draw something on the page
content.draw(page.getCanvas());
// finish the page
document.finishPage(page);
document.writeTo(FileOutputStream(outFile));
// close the document
document.close();
}
I'm aware of saveToGallery, saveToPath and getDrawBitmap methods, but a vector-based format like svg would be nice.