2

GoogleAppEngineでpdfjetによって生成されたPDFファイルをユーザーのgoogledocsにアップロードする必要があります。gae/jのpdfjetを使用してpdfを生成することがわかりました。pdfjetはストリームを使用してpdfを作成します。とにかくストリームをファイルに変換して、ユーザーにgoogledocsをアップロードできるようにする方法はありますか。gaevfsを試しましたが、機能しませんでした。必要に応じて別のPDF生成ソリューション、または別の仮想ファイルシステムなどを使用できます。

PDF生成コード

ByteArrayOutputStream os = new ByteArrayOutputStream();
PDF pdf = new PDF(os);

GoogleドキュメントのAPIコード

DocumentListEntry newEntry = new PdfEntry();
newEntry.setTitle(new PlainTextConstruct("Some Report"));

私がそれを機能させることができなかった行:setFile(File、String)

newEntry.setFile(pdf, "application/pdf");

ありがとう。

4

1 に答える 1

0

メソッドを使ってfrom ByteArrayOutputStreamtoと単純に書けないのでしょうか? このような:FileOutputStreamByteArrayOutputStream.writeTo(OutputStream)

ByteArrayOutputStream os = new ByteArrayOutputStream();
PDF pdf = new PDF(os);  
FileOutputStream fos = new FileOutputStream("myPDF.pdf");
baos.writeTo(os);
于 2010-10-22T12:49:26.617 に答える