跳轉到主要內容

PDF Tools API

網頁轉 PDF API

把把網頁轉成 PDF接進後端、批次任務或產品流程,不需要自行維護 PDF 處理服務。

Credits

1 Credit / call

1 Credit per successful API request. Failed processing attempts are refunded automatically.

Pricing

1,000 Credits = $1

Every signed-in user receives 100 free API Credits each month.

Endpoint

/api/external/webpage-to-pdf/pdf

Use your API Key in the x-api-key header.

Use case

適合定期保存公開網頁、客戶頁面匯出或線上證據留存。網站工具適合人工確認,API 適合穩定重複的伺服器端流程。

cURL example

curl -X POST https://itextmaster.com/api/external/webpage-to-pdf/pdf \
  -H 'x-api-key: YOUR_API_KEY' \
  -F 'url=https://example.com/report' \
  -F 'pageSize=A4' \
  -F 'waitDelay=2' \
  --output webpage.pdf

Multipart example

curl -X POST https://itextmaster.com/api/external/webpage-to-pdf/pdf \
  -H 'x-api-key: YOUR_API_KEY' \
  -F 'url=https://example.com/report' \
  -F 'pageSize=A4' \
  -F 'waitDelay=2' \
  --output webpage.pdf

JSON base64 example

curl -X POST https://itextmaster.com/api/external/webpage-to-pdf/pdf \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{
    "url": "https://example.com/report",
    "pageSize": "A4",
    "waitDelay": 2
  }' \
  --output webpage.pdf

Node.js example

import { writeFile } from 'node:fs/promises';

const response = await fetch('https://itextmaster.com/api/external/webpage-to-pdf/pdf', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': process.env.ITEXTMASTER_API_KEY
  },
  body: JSON.stringify({
  url: 'https://example.com/report',
  pageSize: 'A4',
  waitDelay: 2
})
});

if (!response.ok) {
  throw new Error(await response.text());
}

await writeFile('webpage.pdf', Buffer.from(await response.arrayBuffer()));

Python example

import os
import requests

response = requests.post(
    'https://itextmaster.com/api/external/webpage-to-pdf/pdf',
    headers={
        'Content-Type': 'application/json',
        'x-api-key': os.environ['ITEXTMASTER_API_KEY'],
    },
    json={
        'url': 'https://example.com/report',
        'pageSize': 'A4',
        'waitDelay': 2,
    },
)
response.raise_for_status()

with open('webpage.pdf', 'wb') as f:
    f.write(response.content)

Error codes

400invalid_payload

JSON 或 multipart 請求缺少必要的 HTML、URL 或檔案輸入。

401invalid_api_key

x-api-key 缺少、無效或已輪換。

402insufficient_credits

帳號 API Credits 不足。

502conversion_failed

伺服器端渲染沒有完成轉換;失敗處理會自動退回 Credits。

Limits

  • 需要可正常開啟的 PDF 或有效輸入資料。
  • 請從伺服器端呼叫 API,避免在瀏覽器暴露 API Key。
  • 大量處理前先用代表性樣本確認輸出品質。

Response headers

webpage.pdf,回應標頭會列出本次扣除的 Credits 與剩餘額度。

Content-Type
產出檔案的 MIME 類型,通常是 application/pdf 或 application/zip。
Content-Disposition
產出檔案的下載檔名。
X-Credits-Charged
成功請求扣除的 Credits。
X-Credit-Balance
請求完成後剩餘的 API Credits。

FAQ

網頁轉 PDF API 如何計費?

成功的 網頁轉 PDF API 請求會使用 API Credits;處理失敗會自動退回。每位登入使用者每月有 100 個免費 API Credits,1,000 Credits = $1。

網站工具會使用 API Credits 嗎?

瀏覽器本地處理的網站工具不使用 API Credits;只有帶 API Key 的自動化請求才計費。

可以從前端直接呼叫嗎?

不建議。API Key 應保存在伺服器端、排程任務或後端自動化腳本中。

Start with 100 free API Credits

Create an API Key, test 網頁轉 PDF API, and buy more Credits only when automation volume grows.

iTextMaster

專業PDF工具 - 免費且私密

安全

  • 本機優先處理大多數檔案工具在瀏覽器中執行。
  • 伺服器端處理清楚提示需要伺服器端處理的工具會在提交前明確說明。

選擇語言

© 2026 iTextMaster. © iTextMaster. 保留所有權利。