Manipulating PDFS in Apps Script

49 views
Skip to first unread message

Bruce Mcpherson

unread,
Jun 18, 2024, 11:54:04 AM (11 days ago) Jun 18
to Google Apps Script Community
If you’ve used my [Convert any file with Apps Script](https://ramblings.mcpher.com/gassnippets2/apps-script-file-conversions/) you’ll know that it can take a wide range of files (currently 53 different mimeTypes, 42 types of imports, and 26 kinds of exports) and convert from one format to another. It uses the import and export functionality of the Drive API to find a route (sometimes involving multiple conversions) to, for example, turn a microsoft word file into a pdf.
However, it can’t make image files from anything other than image files in other image formats. This has been a problem when using the free tier [Gemini flash api](https://blog.google/technology/ai/google-gemini-update-flash-ai-assistant-io-2024/). At the time of writing, Gemini only supports media input in image format.
Since the [Convert any file with Apps Script](https://ramblings.mcpher.com/gassnippets2/apps-script-file-conversions/) library can already convert most types to pdf, it seemed to me that a new library convert pdfs to images would be handy. This article is about that. There’ll be future articles about applying the results to the [Gemini API](https://ai.google.dev/gemini-api/docs/api-overview)

article link
https://ramblings.mcpher.com/gassnippets2/manipulating-pdfs-in-apps-script/
Reply all
Reply to author
Forward
0 new messages