In GAE/J, I need to generate a PDF and somehow place it into a ResumableGDataFileUploader to be uploaded to Google Docs. I can’t dump the data into a File because GAE/J doesn’t support any classes that can read or write to a file.
Does anyone know of a good way to fill in the rest of this code?
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(...);
}
You can read, write and create files using the files API in the blobstore.