@robinpath/pdf
0.1.5Node.jsPublicPDF generation from HTML/text and text extraction from PDFs
PDF generation (documents, tables, HTML-to-PDF) and parsing (text extraction, metadata, page count)
Package: @robinpath/pdf | Category: Documents | Type: Integration
Authentication
No authentication required. All functions are available immediately.
Use Cases
Use the pdf module when you need to:
- Generate a PDF document with title, content, and sections -- Use
pdf.generateto perform this operation - Parse a PDF file and extract text, metadata, and page count -- Use
pdf.parseto perform this operation - Extract all text from a PDF file -- Use
pdf.extractTextto perform this operation - Get the number of pages in a PDF -- Use
pdf.pageCountto perform this operation - Get PDF metadata (author, title, creation date, etc.) -- Use
pdf.metadatato perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
generate | Generate a PDF document with title, content, and sections | {path, pages} |
parse | Parse a PDF file and extract text, metadata, and page count | {text, pages, info, metadata} |
extractText | Extract all text from a PDF file | Extracted text content |
pageCount | Get the number of pages in a PDF | Page count |
metadata | Get PDF metadata (author, title, creation date, etc.) | {info, metadata, pages} |
generateTable | Generate a PDF with a formatted table | {path} |
generateFromHtml | Generate a PDF from basic HTML content | {path, pages} |
Functions
generate
Generate a PDF document with title, content, and sections
Module: pdf | Returns: object -- {path, pages}
pdf.generate "./report.pdf" {"title": "Monthly Report", "content": "..."}
| Parameter | Type | Required | Description |
|---|---|---|---|
outputPath | string | Yes | Output file path |
options | object | Yes | {title, author, content, sections, footer, size, margin, fontSize} |
parse
Parse a PDF file and extract text, metadata, and page count
Module: pdf | Returns: object -- {text, pages, info, metadata}
pdf.parse "./document.pdf"
| Parameter | Type | Required | Description |
|---|---|---|---|
filePath | string | Yes | Path to PDF file |
extractText
Extract all text from a PDF file
Module: pdf | Returns: string -- Extracted text content
pdf.extractText "./document.pdf"
| Parameter | Type | Required | Description |
|---|---|---|---|
filePath | string | Yes | Path to PDF file |
pageCount
Get the number of pages in a PDF
Module: pdf | Returns: number -- Page count
pdf.pageCount "./document.pdf"
| Parameter | Type | Required | Description |
|---|---|---|---|
filePath | string | Yes | Path to PDF file |
metadata
Get PDF metadata (author, title, creation date, etc.)
Module: pdf | Returns: object -- {info, metadata, pages}
pdf.metadata "./document.pdf"
| Parameter | Type | Required | Description |
|---|---|---|---|
filePath | string | Yes | Path to PDF file |
generateTable
Generate a PDF with a formatted table
Module: pdf | Returns: object -- {path}
pdf.generateTable "./table.pdf" ["Name","Email"] $rows
| Parameter | Type | Required | Description |
|---|---|---|---|
outputPath | string | Yes | Output file path |
headers | array | Yes | Column headers |
rows | array | Yes | Array of row arrays or objects |
options | object | No | {title, landscape} |
generateFromHtml
Generate a PDF from basic HTML content
Module: pdf | Returns: object -- {path, pages}
pdf.generateFromHtml "./output.pdf" "<h1>Title</h1><p>Content</p>"
| Parameter | Type | Required | Description |
|---|---|---|---|
outputPath | string | Yes | Output file path |
html | string | Yes | HTML content |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
| (standard errors) | Check function parameters and authentication |
@desc "Generate and validate result"
do
set $result as pdf.generate "./report.pdf" {"title": "Monthly Report", "content": "..."}
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. Multi-step PDF workflow
Chain multiple pdf operations together.
@desc "Generate, parse, and more"
do
set $r_generate as pdf.generate "./report.pdf" {"title": "Monthly Report", "content": "..."}
set $r_parse as pdf.parse "./document.pdf"
set $r_extractText as pdf.extractText "./document.pdf"
print "All operations complete"
enddo
2. Safe generate with validation
Check results before proceeding.
@desc "Generate and validate result"
do
set $result as pdf.generate "./report.pdf" {"title": "Monthly Report", "content": "..."}
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- excel -- Excel module for complementary functionality
- office -- Office module for complementary functionality
- docusign -- DocuSign module for complementary functionality
- pandadoc -- PandaDoc module for complementary functionality
- hellosign -- HelloSign module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.5 | latest | 1 months ago |
Related Modules
rightplace
JS@robinpathv0.1.3
RightPlace integration — 130 functions for projects, WordPress, WooCommerce, email, files, git, spreadsheets, stages, docs, automations via rightplace-cli
asana
JS@robinpathv0.1.2
Asana module for RobinPath.
google-sheets
JS@robinpathv0.1.1
Google Sheets module for RobinPath.
airtable
JS@robinpathv0.1.2
Airtable module for RobinPath.
$ robinpath add @robinpath/pdf
