0

I have a database containing the URLs to several thousand published Google Doc URLs.

These URLs look like this and are rendered as an HTML page:​https://docs.google.com/document/d/e/<long-unique-id>/pub

Example

​​The formatting of these published docs gets messed up when trying to print the HTML page, ​so I need them to be PDFs -- either in a new tab or downloadable to the file system.

I've tried this PDF URL structure: ​https://docs.google.com/viewer?url=https://docs.google.com/document/d/<another-long-unique-id>/export?format=pdf

Example

...But the ID from the pub version doesn't work with the export version. It would appear that they expect different IDs.

Is there any way to get my existing "/pub" URLs to work as exportable URLs? Or is there a way to reverse engineer pub URLs back to the regular, shareable URLs?

1

1 Answer 1

0

The short answer is No.

Publishing a Document

  • Publishing a document creates a separate embeddable HTML version of a doc.
  • Anyone with the URL can view the published HTML document
  • The published doc can be a one-time snapshot or can automatically republish when the source doc is changed
  • Publishing (or not) has no bearing on the visibility settings of the original document (i.e. 'Private', 'Anyone with the link', 'Public on the web')
  • Publishing (or not) has no bearing on 'Edit', 'View', and 'Commenting' privileges
  • you cannot adapt the published doc's URL to view or edit the original document

Sharing a Doc Online

What you are describing must be done using the original document's sharing privileges. In other words, in the sharing dialog under "General Access", giving "Viewer" privileges to "Anyone with the link".

Once the viewing permissions are set, then you can create the export as pdf format URLs using the source document's unique ID:

Download Google Doc as PDF:
https://docs.google.com/document/d/<file_ID/export?format=pdf

View Google Doc as PDF:
https://docs.google.com/viewer?url=https://docs.google.com/document/d/<file_ID/export?format=pdf



1
  • 1
    That's what I figured. My team are the publishers, but I was hoping that we wouldn't need to go through all of our documents to get the new link and I could just write a script to convert the published URL. Mar 21, 2023 at 15:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.