# PDF Munk MCP

> PDF Munk converts raw data into structured documents, handling everything from live websites to complex templates. It lets your AI agent generate PDFs and PNGs from URLs or HTML code, then manage them by merging, splitting, compressing, or adding watermarks. Use it when you need reliable, high-fidelity document creation without leaving your chat environment.

## Overview
- **Category:** productivity
- **Price:** Free
- **Tags:** pdf-generation, file-compression, html-to-image, document-merging, rest-api

## Description

You connect the PDF Munk server to your AI client when you need to handle documents—everything from dumping a bunch of raw data into a report to trimming down gigantic files until they fit in an email. You don't gotta switch apps or leave your chat window just because you need a perfectly formatted PDF or a crisp PNG.

When you run into live web content, the `generate_pdf_from_url` tool takes any public website address and converts the whole thing into a standalone PDF file, keeping all the structure intact. If you've got raw HTML code—maybe it came from another system—you use `generate_pdf_from_html`, and it turns that messy code into a high-fidelity, printable PDF that looks right. For capturing specific visuals, `generate_screenshot` grabs an image (PNG or JPG) of any webpage URL you give it, letting you pinpoint exactly what you need to show people without saving the whole page. If you're generating images from structured input rather than a live site, `generate_image` handles that general creation for you.

When your documents gotta look consistent—like reports or invoices—you use templates. First, you check out all the options by running `list_templates`, which pulls up every template ID available. Then, if you know what you need, `get_template` grabs the specific details and structure of that PDF template ID. Finally, `generate_pdf_from_template` populates that predefined structure with your new data, making sure everything—the logos, the fields, the fonts—is locked down exactly how it should be for consistent branding.

Handling existing documents is just as big a deal. You can take multiple separate PDF files and stick 'em together into one cohesive document using `merge_pdfs`. If that single merged file gets too huge or contains unnecessary pages, you use `split_pdf` to break the large document down into smaller chunks based on specific page ranges or criteria. To save space, `compress_pdf` reduces a PDF's file size while doing its best not to mess up how it looks when someone opens it. You can also add visual protection by running `add_watermark`, which overlays custom text or images onto the pages of an existing document.

For checking things out before you commit, run `check_pdfmunk_status` to verify that your API key and server connection are good to go. It's simple maintenance for making sure everything runs smooth when you need it most.

## Tools

### add_watermark
Overlays a specified watermark text or image onto an existing PDF document.

### check_pdfmunk_status
Verifies the connection and operational status of your API key and server setup.

### compress_pdf
Reduces the file size of a PDF while attempting to maintain visual quality.

### generate_image
Creates general images (PNG/JPG) from provided data or templates.

### generate_pdf_from_html
Converts raw HTML code into a high-fidelity PDF document, preserving layout and styles.

### generate_pdf_from_template
Populates a predefined PDF template structure with new data to create a final document.

### generate_pdf_from_url
Takes a public URL and converts the entire webpage content into a standalone PDF file.

### generate_screenshot
Captures an image (PNG/JPG) of a specific web page or section at a given URL.

### get_template
Retrieves the necessary details and structure for using a specific PDF template ID.

### list_templates
Fetches a list of all available templates you can use to generate structured documents.

### merge_pdfs
Combines two or more separate PDF files into a single, cohesive document.

### split_pdf
Separates one large PDF file into multiple smaller PDFs based on page ranges or criteria.

## Prompt Examples

**Prompt:** 
```
Convert 'https://google.com' to a PDF document.
```

**Response:** 
```
I've generated the PDF for you. You can download it here: [PDF Link].
```

**Prompt:** 
```
Generate a shipping label PDF for order #ORD-4521 with customs declaration data.
```

**Response:** 
```
Shipping label PDF generated for order #ORD-4521. Destination: Munich, Germany. Weight: 2.3 kg. Customs declaration included with HS codes for 3 items. Carrier: DHL Express. Tracking barcode embedded. The label includes sender and recipient addresses, package dimensions, and a return label on page 2. File ready for printing at 4x6 inches.
```

**Prompt:** 
```
Convert my HTML report template into a paginated PDF with headers and footers.
```

**Response:** 
```
HTML to PDF conversion complete. Output: 18 pages. Page size: A4. Custom header applied with company logo and report title on each page. Footer includes page numbers ("Page X of 18") and generation timestamp. Table of contents auto-generated on page 1. All CSS styles preserved including charts and data tables. File size: 1.2 MB.
```

## Capabilities

### Convert URLs/HTML to PDF
Takes a website address or raw HTML code and outputs a printable, structured PDF document.

### Capture Web Screenshots
Generates PNG or JPG image files from any given web page URL.

### Merge and Split PDFs
Combines multiple PDF documents into a single file, or breaks one large document into smaller chunks.

### Compress and Watermark Files
Reduces the size of existing PDFs (`compress_pdf`) or embeds custom watermarks onto specific pages.

### Generate from Templates
Populates structured PDF documents using defined templates, ensuring consistent branding and layout for reports.

## Use Cases

### Creating Client Invoices
The accounting team needs to generate 50 invoices daily. Instead of manually filling out a spreadsheet and converting, the agent runs `generate_pdf_from_template` with the order data. The result is 50 perfectly formatted PDFs ready for distribution.

### Reporting on Competitors
A marketer wants to compare competitor pricing structures. They ask their agent to run `generate_pdf_from_url` against three different sites. The system compiles all three into one document, allowing for side-by-side comparison.

### Archiving Meeting Minutes
A project manager needs to archive minutes from a web conference. They run `generate_screenshot` on the main dashboard and then use `add_watermark` with the date stamp across all captured images, creating an undeniable record.

### Combining Legal Documents
A legal assistant receives three separate contract drafts. Instead of printing, scanning, and manually pasting them together, they ask the agent to `merge_pdfs`, combining them into one searchable file in seconds.

## Benefits

- **Consistent Branding:** Use `generate_pdf_from_template` to ensure every generated invoice or report follows the same layout, eliminating manual formatting errors across departments.
- **Full Web Capture:** Need a PDF of a live website? Just use `generate_pdf_from_url`. It handles complex layouts and dynamic content better than simple web scrapers.
- **Multi-Step Workflows:** You can't just generate a document; you might need to run `generate_pdf_from_html`, then `add_watermark`, and finally `merge_pdfs` with another file. This server handles the whole sequence.
- **Visual Proof Points:** When an agent runs `generate_screenshot`, you get a high-res PNG of what the user saw, which is perfect for documentation or error reporting.
- **File Management Safety Net:** If your generated report is too big, use `compress_pdf` right after creation. If it's too long, break it up with `split_pdf` before emailing.

## How It Works

The bottom line is: you pass instructions to your AI client, and it handles the entire document creation workflow using specialized tools.

1. Subscribe to the server on Vinkius and provide your unique PDF Munk API key.
2. Tell your AI agent exactly what you need—for example, 'Generate a PDF from this URL.'
3. The agent calls the appropriate tool (e.g., `generate_pdf_from_url`), which processes the request and returns a downloadable link or base64 string.

## Frequently Asked Questions

**How do I make a PDF from an HTML string using PDF Munk?**
You use `generate_pdf_from_html`. This tool takes raw, formatted HTML code—not just plain text—and converts it into a structured PDF. It preserves your CSS styles and layout fidelity.

**What's the difference between generate_pdf_from_url and generate_screenshot?**
`generate_pdf_from_url` creates an entire, printable document of the webpage. `generate_screenshot` just captures a single image (PNG/JPG) of what that page looks like at one point in time.

**Can I combine multiple PDFs into one using PDF Munk?**
Yes, use the `merge_pdfs` tool. You specify the list of files and the order you want them combined in, resulting in a single output file.

**Which tool should I use if my report is too large?**
Use `compress_pdf`. This runs on an existing PDF and reduces its overall size without destroying the content or structure of the document.

**What does running `check_pdfmunk_status` confirm about my API key?**
It verifies your active connection status and confirms that your credentials are correctly loaded into the MCP environment. If this tool fails, you need to check your API key validity or billing setup directly on the PDF Munk dashboard.

**If I use `generate_pdf_from_url` for a public website and it fails, what error do I receive?**
The tool returns a specific HTTP status code indicating connection failure or resource unavailability. Your agent should be programmed to handle this by retrying the request later or using cached content instead.

**Are there rate limits when calling bulk tools like `generate_pdf_from_html`?**
Yes, standard API usage quotas apply based on your subscription tier. The tool's response will include headers that detail your remaining quota and specific usage limits per minute.

**How does the `split_pdf` tool work if I need to separate files by metadata?**
You specify the criteria, such as document author or a date range. The tool then returns a list of new PDF assets, with each file containing only the pages that match your defined data block.

**Can I convert a website URL to a PDF using my AI agent?**
Yes! Use the `convert_url_to_pdf` tool and provide the target URL. Your agent will return a link to the generated PDF document.