2017-09-24 71 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

歡迎你 –

相關問題