2017-09-24 83 views

回答

1

你需要android.graphics.pdf图书馆参考页是https://developer.android.com/reference/android/graphics/pdf/package-summary.html 和u可以使用下面的代码

// create a new document 
PdfDocument mydocument = new PdfDocument(); 

// crate a page description 
PageInfo mypageInfo = new PageInfo.Builder(new Rect(0, 0, 100, 100), 1).create(); 

// start a page 
Page mypage = mydocument.startPage(mypageInfo); 

// draw something on the page 
View content = getContentView(); 
content.draw(mypage.getCanvas()); 

// finish the page 
mydocument.finishPage(mypage); 
. . . 
// add more pages 
. . . 
// write the document content 
mydocument.writeTo(getOutputStream()); 

// close the document 
mydocument.close(); 
+0

或U可以使用https://stackoverflow.com/questions/25392664/generate-pdf-in -android-without-any-3rd-party-library –

+0

感谢你们俩。我期待着玩这个。最好的祝愿! –

+0

欢迎你 –

相关问题