我使用private void createPdf() throws FileNotFoundException, DocumentException ,IOException {
// create folder to save the pdf
// new FileOutputStream("/Internal storage/")
File pdfFolder = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOCUMENTS), "FolderName");
if (!pdfFolder.exists()) {
pdfFolder.mkdir();
Log.i("creat", "Pdf Directory created");
}
// end creat folder
// create file name using todaydate.
Date date = new Date() ;
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(date);
File myFile = new File(pdfFolder +"/"+ timeStamp + ".pdf");
OutputStream output = new FileOutputStream(myFile);
//Step 1
Document document = new Document();
//Step 2
PdfWriter writer = PdfWriter.getInstance(document, output);
//Step 3
document.open();
//Step 4 Add content
document.add(new Paragraph("\n\nTAX INVOICE.\n"));
document.add(new Paragraph("\n\n\n\n\n\n\n\n\n\n\n*THIS IS COMPUTER GENERATED INVOICE NO SIGNATURE REQUIRED."));
//Step 5: Close the document
document.close();
UploadToServer(myFile,userid,username);
}
创建pdf文件。这是代码:
UploadToServer(myFile, userid, username);
现在在函数userid
中显示我正在给出myFile类型文件,pdffile
和用户名类型字符串。
我希望此功能上传pdf文件,让我们说到这个文件夹" www.ccc.com/pdffiles" ;,并在userid
数据库内容中创建一行到该pdf文件的URL ,用户名和from IPython.display import HTML
# Youtube
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/S_f2qV2_U00?rel=0&controls=0&showinfo=0" frameborder="0" allowfullscreen></iframe>')
还来自另一项活动我想从URL查看pdf文件,我将从pdffile数据库中获取网址