PDF Export
Exports a Google Slides presentation as a PDF file.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Presentation Id - The ID of the Google Slides presentation to export as PDF.
- File Path - The local file path where the PDF will be saved.
Options
- Credentials - Google account credentials used to authenticate with the Google Slides API.
How It Works
The PDF Export node converts a Google Slides presentation to PDF format and saves it to a specified local file path. When executed, the node:
- Validates the provided Presentation Id and File Path inputs
- Authenticates with Google Slides API using the provided credentials
- Exports the presentation as a PDF using the Google Drive API
- Saves the PDF file to the specified local file path
Requirements
- A valid Google Slides presentation ID
- Valid Google API credentials with appropriate permissions
- A valid local file path for saving the PDF
- Proper permissions to access the presentation and write to the file path
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Presentation Id
- Empty or invalid File Path
- Invalid or missing Google API credentials
- Google Slides API authentication errors
- Insufficient permissions to access the presentation
- Invalid presentation ID
- File system errors when saving the PDF
- Google Drive service errors
Usage Notes
- The Presentation Id can be found in the URL of the Google Slides presentation
- The File Path should be a complete local path including the filename and .pdf extension (e.g., C:\Documents\presentation.pdf)
- The node will overwrite the file if it already exists at the specified path
- Ensure the authenticated account has permission to access the presentation
- The exported PDF will maintain the formatting and layout of the original presentation
- The PDF export uses default Google Slides export settings
- Make sure the application has write permissions to the specified file path directory
Examples
Example 1: Export to Local Directory
Export a presentation to a local file:
Presentation Id: "1ABC..."
File Path: "/home/user/reports/monthly-report.pdf"
Creates a PDF file at the specified path.
Example 2: Export with Dynamic Filename
Generate filename with current date:
// In a JS node
const today = new Date();
const dateStr = today.toISOString().split('T')[0]; // 2024-12-23
msg.pdfPath = `/home/user/reports/sales-report-${dateStr}.pdf`;
// Then use PDF Export node with msg.pdfPath as File Path
Example 3: Export to Temporary Directory
Export to temp folder for processing:
Presentation Id: "1ABC..."
File Path: "/tmp/presentation-export.pdf"
Useful when the PDF needs further processing or uploading.
Example 4: Batch Export Multiple Presentations
Export several presentations as PDFs:
const presentations = [
{ id: "1ABC...", name: "Q1 Report" },
{ id: "2DEF...", name: "Q2 Report" },
{ id: "3GHI...", name: "Q3 Report" }
];
for (const pres of presentations) {
msg.presentationId = pres.id;
msg.filePath = `/home/user/reports/${pres.name}.pdf`;
// Use PDF Export node here
}
Tips for Effective Use
- File Paths: Use absolute paths to avoid confusion about working directory
- Naming Convention: Include dates, version numbers, or identifiers in filenames
- Directory Creation: Ensure target directory exists before exporting
- File Permissions: Verify write permissions to target directory
- Path Separators: Use forward slashes (/) or escape backslashes (\) in paths
- Overwrite Awareness: Remember that existing files will be overwritten silently
- Post-Processing: Store the file path for subsequent upload or email operations
Common Use Cases
Use Case 1: Automated Report Distribution
Generate and distribute PDF reports:
// 1. Create or update presentation
// 2. Export to PDF
const reportDate = new Date().toISOString().split('T')[0];
msg.pdfPath = `/home/user/reports/weekly-report-${reportDate}.pdf`;
// (Use PDF Export node)
// 3. Upload to cloud storage or email
// (Use file upload or email nodes)
Use Case 2: Archival Workflow
Archive presentations as PDFs for record-keeping:
const presentations = msg.presentationsToArchive; // Array of presentation IDs
for (const presId of presentations) {
const timestamp = new Date().toISOString().replace(/:/g, '-');
msg.presentationId = presId;
msg.archivePath = `/archive/presentations/${presId}_${timestamp}.pdf`;
// Export to PDF
// Then log to database or spreadsheet
}
Use Case 3: Client Deliverable Generation
Create final client deliverables:
// After personalizing presentation for client
msg.clientName = "Acme Corp";
msg.presentationId = msg.personalizedPresentationId;
// Export to PDF
msg.pdfPath = `/deliverables/${msg.clientName.replace(/\s+/g, '_')}_Proposal.pdf`;
// (Use PDF Export node)
// Then email to client
msg.emailTo = msg.clientEmail;
msg.emailSubject = `Your Personalized Proposal from Our Company`;
msg.emailAttachment = msg.pdfPath;
// (Use Email node)
Use Case 4: Print-Ready Document Generation
Generate print-ready versions of presentations:
// Workflow: Create presentation → Export to PDF → Upload to print service
const presentations = [
{ id: "1ABC", filename: "Brochure_English" },
{ id: "2DEF", filename: "Brochure_Spanish" },
{ id: "3GHI", filename: "Brochure_French" }
];
for (const pres of presentations) {
msg.presentationId = pres.id;
msg.pdfPath = `/print-ready/${pres.filename}.pdf`;
// Export to PDF
// Upload to print service API
}
Use Case 5: Backup and Version Control
Create PDF backups of important presentations:
// Daily backup routine
const importantPresentations = await getImportantPresentations();
const backupDate = new Date().toISOString().split('T')[0];
for (const pres of importantPresentations) {
msg.presentationId = pres.id;
msg.backupPath = `/backups/${backupDate}/${pres.name}_${backupDate}.pdf`;
// Export to PDF
}
Use Case 6: Multi-Format Output
Export presentation in multiple formats:
// Export same presentation for different purposes
msg.presentationId = "1ABC...";
// High-quality version for archival
msg.archivalPath = `/archive/presentation-archive-${Date.now()}.pdf`;
// (PDF Export node)
// Email version
msg.emailPath = `/temp/presentation-email.pdf`;
// (PDF Export node)
// Print version
msg.printPath = `/print/presentation-print.pdf`;
// (PDF Export node)
Workflow Integration
Complete Presentation Generation and Distribution Workflow
// 1. Copy template presentation
// msg.presentationId = [from Copy Presentation node output]
// 2. Replace text placeholders
// (Use Replace Text nodes)
// 3. Replace images
// (Use Replace Shapes With Image nodes)
// 4. Add dynamic charts
// (Use Add Image nodes)
// 5. Export to PDF
const clientName = msg.clientName.replace(/\s+/g, '_');
const dateStr = new Date().toISOString().split('T')[0];
msg.pdfFilename = `${clientName}_Proposal_${dateStr}.pdf`;
msg.pdfPath = `/deliverables/${msg.pdfFilename}`;
// (Use PDF Export node)
// 6. Upload to cloud storage
// (Use cloud storage upload node)
// 7. Send email with PDF link
// (Use Email node)
// 8. Log to tracking system
// (Use database insert or spreadsheet append)
Common Errors and Solutions
| Error | Cause | Solution |
|---|---|---|
| "Presentation ID cannot be empty" | No ID provided or ID is "_" | Ensure valid Presentation Id is provided |
| "File path cannot be empty" | No file path provided | Provide complete file path with .pdf extension |
| "No Credential Content" | Credentials missing or invalid | Verify credentials in Vault have Google Drive API access |
| Permission denied (presentation) | Account lacks access to presentation | Ensure authenticated account can access the presentation |
| Permission denied (file system) | No write access to directory | Check directory permissions and ensure it exists |
| Invalid file path | Malformed path or invalid characters | Use valid file path syntax for your operating system |
| Directory not found | Target directory doesn't exist | Create directory before exporting or use existing path |
| Disk space full | Insufficient storage space | Free up disk space or use different directory |
| File in use | PDF file is open in another program | Close the file or use different filename |
Best Practices
- Directory Management: Create dated subdirectories for organized storage (e.g.,
/reports/2024/12/) - Error Handling: Wrap export in try-catch to handle cases where export might fail
- File Cleanup: Implement cleanup routines to remove old PDF exports
- Naming Standards: Establish consistent naming conventions across your organization
- Verification: After export, verify file exists and has non-zero size
- Metadata Logging: Log export metadata (filename, size, timestamp) to a database or spreadsheet
- Post-Export Actions: Chain with upload, email, or archival nodes for complete workflows
- Path Validation: Validate file paths before export to catch errors early
Advanced Techniques
PDF Size Verification
// After PDF Export
const fs = require('fs');
const stats = fs.statSync(msg.pdfPath);
const fileSizeInMB = stats.size / (1024 * 1024);
if (fileSizeInMB < 0.1) {
throw new Error('PDF file is suspiciously small, export may have failed');
}
msg.pdfSizeMB = fileSizeInMB.toFixed(2);
// Continue with upload or email
Conditional Export
// Only export if presentation was modified recently
const presentation = msg.presentationMetadata;
const lastModified = new Date(presentation.modifiedTime);
const hoursSinceModified = (Date.now() - lastModified) / (1000 * 60 * 60);
if (hoursSinceModified < 24) {
// Export to PDF
msg.pdfPath = `/recent-exports/${presentation.id}.pdf`;
// (Use PDF Export node)
}
Parallel Export Processing
For multiple presentations, export in batches to optimize performance:
// Batch export presentations
const presentations = msg.presentationsToExport;
const batchSize = 5;
for (let i = 0; i < presentations.length; i += batchSize) {
const batch = presentations.slice(i, i + batchSize);
for (const pres of batch) {
msg.presentationId = pres.id;
msg.pdfPath = `/exports/${pres.id}.pdf`;
// Export each in batch
}
// Small delay between batches to avoid rate limiting
await sleep(2000);
}