# Merge several web pages into one PDF

**Use case:** 

Combine several web pages into a single PDF. List the URLs in the order you want and turn on merge: you get one PDF per page plus one merged file. Useful for archiving articles, assembling documentation or sending a reading pack.

## Input

```json
{
  "sourceType": "url",
  "startUrls": [
    {
      "url": "https://en.wikipedia.org/wiki/Web_scraping"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Web_crawler"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Data_scraping"
    }
  ],
  "outputFormat": "pdf",
  "viewMode": "viewport",
  "viewportWidth": 1920,
  "viewportHeight": 1080,
  "scaleFactor": 2,
  "imageQuality": 80,
  "paperFormat": "A4",
  "printBackground": true,
  "mergePdfs": true,
  "smartScroll": true,
  "scrollDelay": 500,
  "removeSelectors": [],
  "clickSelectors": [],
  "hideFixedElements": true
}
```

## Output

```json
{
  "url": {
    "label": "URL",
    "format": "string"
  },
  "outputFormat": {
    "label": "Format",
    "format": "string"
  },
  "viewMode": {
    "label": "Mode",
    "format": "string"
  },
  "fileName": {
    "label": "File",
    "format": "string"
  },
  "fileUrl": {
    "label": "Download",
    "format": "string"
  },
  "fileSize": {
    "label": "Size (bytes)",
    "format": "number"
  },
  "capturedAt": {
    "label": "Captured",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The HTML to PDF & URL to PDF API - Website Screenshots Actor is ready to run with the inputs already set for "Merge several web pages into one PDF". [Sign up or log in](https://console.apify.com/create-task-from-example/BzOH65EuvfYopyzpe) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Merge several web pages into one PDF" task

The HTML to PDF & URL to PDF API - Website Screenshots Actor will start running based on the input automatically. You can also change all the input fields, like source type, start urls, and more, to match your specific use case.

### 3. Receive the "Merge several web pages into one PDF" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as URL, format, mode, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Merge several web pages into one PDF" task via API](https://apify.com/autofacts/universal-web-printer.md).

## FAQ

### Do I also get the individual PDFs?

Yes. Each page still gets its own PDF, and one extra record holds the merged file.

### Can I merge pages from different sites?

Yes. Any mix of public URLs works.

### Where do I get the file?

Each result has a download link. The files are also in the run’s key-value store, and you can fetch them through the Apify API.

### How much does it cost?

You pay per page rendered, plus a small extra for options such as watermarks, passwords or merging. Pages that fail to render are not charged. See the Pricing tab for current rates.

## About this Actor

This example demonstrates how to use [HTML to PDF & URL to PDF API - Website Screenshots](https://apify.com/autofacts/universal-web-printer.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/autofacts/universal-web-printer.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/autofacts/universal-web-printer.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
