One Page PDF Generator

注意

*画像ファイル指定時はURLにするか、base64 にして埋め込んでください。

API Reference

/api/pdf

POST

Generate a PDF from HTML content.

Request Body

{
  "contents": string,    // Required: HTML content to render as PDF
  "width": number,       // Optional: Width of the PDF (default: 172)
  "height": number,      // Optional: Height of the PDF (default: 240)
  "unit": string,        // Optional: Unit for width and height (default: "mm", options: "mm", "cm", "in", "px")
  "out_of_all": boolean  // Optional: Output all pages instead of first page only (default: false)
}

Response

Status Codes

Example

fetch('/api/pdf', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    contents: '<html><body><h1>Hello World</h1></body></html>',
    width: 210,
    height: 297,
    unit: 'mm'
  }),
})
.then(response => response.blob())
.then(blob => {
  // Handle the PDF blob
});