---
title: "Generate pdf file from url using the excellent tool wkhtmltopdf."
method: POST
path: "/api/v1/pdf/wkhtmltopdf"
tags: ["Pdf"]
---

# Generate pdf file from url using the excellent tool wkhtmltopdf.

`POST /api/v1/pdf/wkhtmltopdf`

## Request body

- WkHtmlToPdfRequestDto — WkHtmlToPdfRequestDto is the data transfer object for generating a pdf using wkhtmltopdf;
  - `url` string, nullable — The url to generate pdf from. Url has precedence over HtmlBase64String value if both are set.
  - `htmlBase64String` string, nullable — Base64 encoded string with html. If property Url is set, it will be used, not HtmlBase64String.
  - `resources` object, nullable — This is a set of key-value pairs of digital resources like images that is referenced in the HtmlBase64String document. It uses the filename including relative path as key and the data is provided as a Base64 encoded string.
  - `wkHtmlToPdfArguments` object, nullable — Command line arguments passed to wkhtmltopdf. Invalid arguments will be ignored. Invalid arguments are "manpage", "help", "H", "h", "extended-help", "htmldoc", "readme", "license", "read-args-from-stdin", "readme", "version", "V", "debug-javascript", "no-debug-javascript", "enable-local-file-access", "disable-local-file-access", "allow".

## Response `200`

Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json

- PdfResponseDto — When setting the Accept-header in the request to "application/json" the content of the pdf file will be return as Base64 encoded string. Note that converting data to Base64 encoded strings increases the response size with approximately 33%, if you can accept the a binary format it's better to use Accept-header "application/pdf".
  - `errorMessage` string, nullable — If any error occurs the message will be displayed in here
  - `pdfFileBase64String` string, nullable — The Base64 encoded string that is the pdf file.

## Other responses

- `400` — If any error occurs executing request
- `415` — If content-type of request is not set to application/json
- `429` — If you reach the monthly request limit for your subscription plan
- `503` — If the service is temporarily unavailable due to high load

---

[API](https://skmtc.net/pdfbroker/apis/pdfbroker-io-api.md) · [All operations](https://skmtc.net/pdfbroker/apis/pdfbroker-io-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pdfbroker/pdfbroker-io-api/versions/c10982b50857/schema)
