0

I need to split a pdf document which I did not create myself into its pages, one page per file.

If I choose to print the pdf for example in google chrome I can then print to pdf just the first page and then the second page etc. So it is possible to to this by hand but how can I automate this split and save using google apps script?

The pdf in this use case came in per mail and has been saved to google drive.

Thanks in advance!

J B
  • 23
  • 2
  • There are some results on how to do this using PHP or Java on SO but none using google apps script. Generally one can create pdfs from gdocs or gsheets quite easily with code and there are plugins to merge pdfs but nothing for splitting a pdf. – J B Sep 23 '20 at 04:31
  • See https://stackoverflow.com/a/57533158 for merging. I suppose splitting should be done in a similar way, but you need delve into binary code and have a deeper understanding of file structure of PDFs – TheMaster Sep 23 '20 at 12:01

1 Answers1

0

Yes, Apps Script doesn't support editing PDFs. It does have a service from the DriveApp class to export files in PDF format File.getAs(contentType), but you are starting out with the PDF.

There are several online services for converting, editing, splitting, creating PDFs. Unfortunately Apps Script doesn't have a PDF service.

Aerials
  • 3,337
  • 1
  • 12
  • 18