AODocs PDF Generator: set up the basic custom script in a library

The AODocs PDF Generator:

  1. Copies and converts to PDF format all the attached files in a document.
  2. Merges them into a single PDF file.
  3. Makes the PDF available in one of the following ways:
    • Print to AODocs: attaches the PDF file to the current document
    • Print to Drive: opens the PDF in a new tab in your browser – the file is located in your My Drive
    • Print to Google Cloud Storage: opens the PDF in a new tab in your browser in an AODocs – the file is located in a temporary Google Cloud Storage bucket managed by AODocs

This article explains how to create a Viewer action custom script that performs these actions. The article Generate a PDF from the attached files in an AODocs document explains the end user experience.

You can add the AODocs PDF Generator to any type of AODocs library via a custom script.

Note: You can't print to AODocs in Team Folders or Secured Folders. These libraries can contain only one attached file, so you can't add the PDF as an attached file. 

The AODocs PDF Generator has many advanced features, so you can adapt it to your specific business needs. Learn more: AODocs PDF Generator: set up advanced features.

This article explains how to:

Automatically generated table of contents

Create a custom script

1. Create a new custom script. You can name it as you like. Define it as type Viewer Action.

Learn more: Custom scripts.


2. Click the name of your custom script to configure it.

3. Leave the default options:

  • Run with current user's privileges
  • checkbox Async execution unselected

4. Depending on which type of basic custom script you want to use, copy the code from one of the following the sample custom scripts into your custom script:

5. If you are working in a library that uses Google Cloud Storage or Azure Blob storage, you must remove the forward slashes at the beginning of these lines:


6. Click Save.

Basic Print to AODocs custom script

Create a custom action

Create a custom action according to your business requirements.

1. In the library administration, open the document class in which you want to use the script (in our example, "Document") and select the Custom tab.

2. Click the Add a new viewer custom action button. 

3. Enter the text that will appear in the user interface to run the custom script, in our example, "Generate PDF".

4. Select the required custom script, in our example, "AODocs PDF Generator". 

5. Click Create.


Was this article helpful? 1 out of 1 found this helpful
If you didn’t find what you were looking for, don’t hesitate to leave a comment!
Have more questions? Submit a request



Please sign in to leave a comment.