PdfPecker
v1.25.0HTML and Markdown to PDF with page previews, PDF text and merging.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
html_to_pdf HTML to PDF
Converts HTML with CSS to a PDF file. Give the HTML inline or as a file; relative image, CSS and font paths resolve against the HTML file's folder (or the root for inline HTML). Use @page rules for size, margins, running headers and page numbers. No JavaScript runs and nothing loads from the network. Returns the page count and, by default, previews of the first pages.
| Parameter | Type | Description |
|---|---|---|
output_path * | string | The PDF file to write. |
accessibility | string | Write a tagged (accessible) PDF. |
author | string | |
conformance | string | Write an archival PDF/A file. |
fonts | array | Font files or folders (.ttf, .otf, .woff2) that CSS font-family can name. Needed for scripts other than Latin, Greek and Cyrillic. |
footer_text | string | A line at the bottom of every page, such as "Page {page} of {pages}". |
header_text | string | A line at the top of every page; {page} and {pages} are replaced. |
html | string | The HTML document. Give this or html_path. |
html_path | string | An HTML file to convert. Give this or html. |
landscape | boolean | Turn the page size sideways. |
language | string | The document language, such as en-GB. |
margin | number | Page margins in points (72 per inch), default 36. @page margin wins. |
page_size | string | A3, A4, A5, Letter or Legal (default A4), or WIDTHxHEIGHT in mm such as 100x150. A CSS @page size rule wins. |
preview | boolean | Also return images of the first pages (up to 3, at 60 dpi) to check the layout. Default true. |
title | string | The document title; default: the HTML <title>. |
use_system_fonts | boolean | Also use the fonts installed on this machine. |
markdown_to_pdf Markdown to PDF
Converts Markdown (CommonMark with GitHub tables, task lists, strikethrough and footnotes) to a PDF file. Images resolve against the Markdown file's folder.
| Parameter | Type | Description |
|---|---|---|
output_path * | string | The PDF file to write. |
accessibility | string | Write a tagged (accessible) PDF. |
author | string | |
conformance | string | Write an archival PDF/A file. |
fonts | array | Font files or folders (.ttf, .otf, .woff2) that CSS font-family can name. Needed for scripts other than Latin, Greek and Cyrillic. |
footer_text | string | A line at the bottom of every page, such as "Page {page} of {pages}". |
header_text | string | A line at the top of every page; {page} and {pages} are replaced. |
landscape | boolean | Turn the page size sideways. |
language | string | The document language, such as en-GB. |
margin | number | Page margins in points (72 per inch), default 36. @page margin wins. |
markdown | string | The Markdown text. Give this or markdown_path. |
markdown_path | string | A Markdown file to convert. Give this or markdown. |
page_size | string | A3, A4, A5, Letter or Legal (default A4), or WIDTHxHEIGHT in mm such as 100x150. A CSS @page size rule wins. |
preview | boolean | Also return images of the first pages (up to 3, at 60 dpi) to check the layout. Default true. |
title | string | The document title; default: the HTML <title>. |
use_system_fonts | boolean | Also use the fonts installed on this machine. |
render_pdf_pages Look at PDF pages
Renders PDF pages to PNG images and returns them, to check a layout. At most 20 pages per call; for a long PDF, look at the first, a middle and the last page.
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | |
dpi | number | Resolution, default 80; 150 for small detail. |
pages | string | Pages such as "1", "1-3,5" or "last". Default: "1". |
password | string |
pdf_to_text Read PDF text
Extracts the text of a PDF in reading order, with a line marking the start of each page.
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | |
pages | string | Pages such as "1", "1-3,5", "8-" or "last", numbered from 1. Default: all. |
password | string |
pdf_to_markdown PDF to Markdown
Converts a PDF, any PDF, to GitHub Flavored Markdown: headings, paragraphs, lists and tables in reading order. Better than pdf_to_text for documents with structure. Returns the Markdown, or writes it to output_path when given.
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | |
output_path | string | A .md file to write instead of returning the text. |
page_comments | boolean | Start each page with <!-- page N -->. |
pages | string | Pages such as "1", "1-3,5", "8-" or "last", numbered from 1. Default: all. |
password | string |
pdf_to_pdfa Convert PDF to PDF/A
Converts an existing PDF to PDF/A for long-term archiving (fonts embedded, colours made device independent, scripts removed; text stays text). Returns what it changed and anything it could not fix. Encrypted and signed PDFs are refused.
| Parameter | Type | Description |
|---|---|---|
output_path * | string | The PDF/A file to write. |
pdf_path * | string | |
conformance | string | Default PDF/A-2b; the U levels also keep the text searchable. |
pdf_info PDF page count
Returns the number of pages and the file size of a PDF.
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | |
password | string |
merge_pdfs Merge PDFs
Merges PDF files into one, in the order given, keeping links, bookmarks and form fields.
| Parameter | Type | Description |
|---|---|---|
output_path * | string | The PDF file to write. |
pdf_paths * | array | |
title | string |