Strategies to GoogleDrive API limit export download 10 mb

强颜欢笑 提交于 2019-12-23 19:18:10

问题


We've been developing a solution which is responsible for generating a PPT with a lot of images embedded and then downloading in the browser via Google Slides and Google Drive API.

So, we discovered in the middle of the project that there's a limitation on the export of files from Google Drive API - currently at 10mb per file. Some PPT's are supposed to have thousand pics on them, so that's not ok for us.

Here's a sample of the method used for exporting and downloading the PPT file.

public byte[] downloadPPT() throws IOException {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

    driveService.files().export(getPresentation().getPresentationId(),
           "application/vnd.openxmlformats-officedocument.presentationml.presentation").
           executeMediaAndDownloadTo(outputStream);

    if (googleProperties.getRemovePresentationAfterDownload()) {
        driveService.files().delete(getPresentation().getPresentationId()).execute();
    }

    return outputStream.toByteArray();
}

Does anyone has a suggestion of solution that can solve this, that keep us using Google API's?

Thanks in advance!


回答1:


To export Google Slides without size limit you can use direct link for pptx version:

GET https://docs.google.com/presentation/d/<FILE_ID>/export/pptx

Reference: https://www.labnol.org/internet/direct-links-for-google-drive/28356/



来源:https://stackoverflow.com/questions/50612407/strategies-to-googledrive-api-limit-export-download-10-mb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!