1

PDFファイルを作成してSDカードに保存しようとしています。問題の解決策を探しましたが、ネットで見つけたのは、ファイルまたは画像の作成と保存に関するものでした。しかし、どちらも私の問題を解決しません。ここに私のサンプルコードがあります:

 public void createPdf(){
     Document document = new Document();  
     try {           
             PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStoragePublicDirectory("DIRECTORY_PDF") + java.io.File.separator + "droidtext" + java.io.File.separator + "HelloWorld"));
             document.open();
             document.add(new Paragraph("Hello World"));
     } catch (DocumentException de) {
             System.err.println(de.getMessage());
     } catch (IOException ioe) {
             System.err.println(ioe.getMessage());
     }
     document.close();

logcat の内容は次のとおりです。

02-21 06:28:08.001: W/System.err(859): /mnt/sdcard/DIRECTORY_PDF/droidtext/HelloWorld: open failed: ENOENT (No such file or directory)

4

0 に答える 0