WorkersTools
Documentgenerator
📸 Screenshots
Here are visual examples of this section:
Documentgenerator - Worker Configuration Interface
1. Overview and Purpose
The Documentgenerator worker converts text content into formatted documents in DOCX, PDF, or CSV formats. It processes markdown-formatted input and generates professional documents with proper styling, headings, lists, and formatting. The worker uploads generated files to temporary storage and returns a downloadable URL.
2. Configuration Parameters
The Worker accepts the following parameters:
doc: Specifies the output document format. Can be "docx" (default), "pdf", or "csv".
3. Input/Output Handles
input: Input handle - accepts string content, typically markdown-formatted text from AI workersoutput: Output handle - returns a URL string pointing to the generated document file
4. Usage Examples with Code
// Configure document generator for PDF output
const docGenerator = agent.initializeWorker(
{ type: 'documentGenerator' },
[
{ type: 'string', direction: 'input', title: 'AI Input', name: 'input' },
{ type: 'file', direction: 'output', title: 'Generated File URL', name: 'output' }
],
documentGenerator,
{ doc: 'pdf' }
)5. Integration Examples
This worker is commonly used as the final step in content generation workflows, converting AI-generated reports, documentation, or structured data into downloadable documents for end users.
6. Best Practices
- Use markdown formatting in input content for best results with DOCX and PDF generation
- Include a title in your content (as H1 heading or frontmatter) for proper filename generation
- For CSV output, structure content with tables, lists, or clear data separation
- Test different document formats to find the best fit for your content type
7. Troubleshooting Tips
- If document generation fails, check that input content is properly formatted markdown
- Large documents may take longer to process, especially PDF generation with complex formatting
- CSV format works best with tabular data, lists, or simple structured content
- Ensure proper markdown syntax for headings, lists, and formatting to appear correctly in generated documents
