parts
parameter allows you to define the content sources that will be rendered into your PDF document.
Overview
When generating a PDF, you need to specify what content to render. Theparts
parameter accepts an array of content sources, which can be URLs, HTML strings, or structured content objects. These sources are rendered sequentially into a single PDF document.
Parameter details
Defines the content sources that will be rendered into your PDF documentMin items: 1Max items: 50Item types: URL string, HTML string, or content object
Usage
Behavior
Theparts
parameter accepts three types of content:
- URL strings: Publicly accessible URLs that return HTML content.
- HTML strings: Raw HTML content that starts with a valid HTML tag.
- Content objects: Structured objects with
type
andcontent
fields. The content object can be:- URL content with
type: "url"
- HTML content with
type: "html"
- Template content with
type: "template"
(see the Templates page for details)
- URL content with
Use cases
This parameter is particularly useful for:- Multi-source documents: Combine content from multiple webpages into a single PDF.
- Mixed content types: Blend web content with custom HTML in the same document.
- Report generation: Create comprehensive reports by combining dynamic web content with static templates.
- Document assembly: Build documents from multiple components stored in different locations.
- Dynamic content injection: Use templates with context data to generate personalized documents.