GAE / J:将PDF数据写入Google Doc

时间:2012-05-31 17:02:08

标签: java google-app-engine

在GAE / J中,我需要生成PDF并以某种方式将其放入ResumableGDataFileUploader以上传到Google Docs。我无法将数据转储到文件中,因为GAE / J不支持任何可以读取或写入文件的类。

有没有人知道填写其余代码的好方法?

DocsService docsService = ...
Asset asset = new Asset("text/html", getHTML().getBytes(), "");
Document document = new Document(asset);
Conversion conversion = new Conversion(document, "application/pdf");
ConversionService service = ConversionServiceFactory.getConversionService();
ConversionResult result = service.convert(conversion);
for (Asset assetIter : result.getOutputDoc().getAssets()) {
    byte[] data = assetIter.getData();
    //How do I get the generated PDF into the ResumableGDataFileUploader?
    ...
    ResumableGDataFileUploader.Builder builder = new ResumableGDataFileUploader.Builder(...);
}

1 个答案:

答案 0 :(得分:0)

您可以使用blobstore中的文件API来读取,编写和创建文件。