Converting individual tabs in a large Google Docs file to separate PDFs

Help needed with Google Docs tabs and PDF conversion

I’ve got this huge Google Docs file with about 15-20 tabs. I’m trying to turn each tab into its own PDF file. The whole thing is too big to export as one PDF (it’s around 120 pages and 65 MB).

I tried using Apps Script, but I’m new to it and can’t figure out how to:

  1. Export just one tab as a PDF
  2. Turn a tab into a separate Google Doc

I looked at the official docs and some Stack Overflow posts, but nothing seems to work. I’d rather not use the API if possible, because I hit rate limits.

Has anyone done this before? Is there an easy way to save each tab as its own PDF without doing it manually? Or maybe there’s a trick to turn a tab into a new Doc first?

Here’s a bit of my code that isn’t working:

function docToPDF(){
  const doc = DocumentApp.getActiveDocument();
  const ftab = doc.getTabs()[0];
  const ftabdoc = ftab.asDocumentTab();
  // Tried various methods here, but none work
  // folder.createFile(ftabdoc.getBlob()) // Doesn't work
  // const pdfdoc = ftabdoc.getAs('application/pdf'); // Also doesn't work
}

Any ideas? Thanks!

I’ve dealt with similar situations before, and I found a workaround that might help you out. Instead of trying to export directly from Google Docs, consider copying each tab into a new, separate Google Doc. What worked for me was to open the main document, select all content on the desired tab, and then copy and paste it into a new document. Once you have the content in a new Google Doc, you can easily export it as a PDF using File > Download > PDF Document. This method bypasses the export size limitations and eliminates the need for coding. If you need to automate the process later, the Google Docs API might be a viable option. Hope this helps!

Have you considered using a Google Apps Script to automate this process? I’ve had success with a similar task by creating a script that loops through each tab and exports it as a separate PDF. Here’s a basic outline of how it could work:

Get all tabs in the document, and for each tab set it as the active tab, export it as a PDF using DriveApp.createFile(), and name the PDF based on the tab name.

This approach avoids manual work and rate limits. You’ll need to tweak the script for your specific document structure, but it should handle the bulk of the conversion automatically. Just make sure to test it on a copy of your document first.

If scripting isn’t your thing, there are also some add-ons in the Google Workspace Marketplace that might help, though I haven’t personally tried them for this specific use case.

hey there, i’ve had similar issues before. have you tried using the print function? go to File > Print, then choose Save as PDF under Destination. you can select specific pages to export. it’s not perfect, but it might help with smaller chunks of your doc. good luck!