PDF API – Tiontaigh suíomhanna gréasáin & HTML go PDF trí webseirbhís

Comhtháthaigh tiontú Web-to-PDF web2pdf.eu go díreach i d’fheidhmchlár. Cuireann comhéadan HTTP simplí PDFanna picteilín-chruinn ar ais – gan comhartha uisce, comhlíontach le GDPR.

Endpoint

Seol iarratas POST leis an sprioc-URL mar JSON. Is é an freagra an PDF go díreach.

ModhPOST
URLhttps://web2pdf.eu/api/generate-pdf
HeaderContent-Type: application/json
Body{ "url": "https://example.com" }
Freagraapplication/pdf (sonraí dénártha)

Sampla: curl

curl -X POST https://web2pdf.eu/api/generate-pdf \
     -H "Content-Type: application/json" \
     -d '{"url": "https://www.google.com"}' \
     --output google.pdf

Sampla: JavaScript / Node.js

// Node.js / Browser (fetch)
const res = await fetch("https://web2pdf.eu/api/generate-pdf", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://example.com" })
});

const buffer = Buffer.from(await res.arrayBuffer());
await require("fs/promises").writeFile("example.pdf", buffer);

Sampla: PHP

<?php
$ch = curl_init("https://web2pdf.eu/api/generate-pdf");
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ["Content-Type: application/json"],
    CURLOPT_POSTFIELDS     => json_encode(["url" => "https://example.com"]),
    CURLOPT_RETURNTRANSFER => true,
]);
$pdf = curl_exec($ch);
curl_close($ch);
file_put_contents("example.pdf", $pdf);

Sampla: Python

# Python (requests)
import requests

res = requests.post(
    "https://web2pdf.eu/api/generate-pdf",
    json={"url": "https://example.com"},
)
with open("example.pdf", "wb") as f:
    f.write(res.content)

HTML in ionad URL: HTML-go-PDF-API

An bhfuil HTML agus CSS agat cheana féin agus ba mhaith leat PDF a chruthú astu? Seol do mharcáil chuig an endpoint POST /api/html-to-pdf leis an mBody { "html": "…", "css": "…" }. Bain triail as sa bhrabhsálaí leis an tiontóir HTML-go-PDF.

Cásanna úsáide tipiciúla

  • Sonraisc, tairiscintí agus tuairiscí a chruthú go huathoibríoch mar PDF.
  • Suíomhanna gréasáin agus ailt a chartlannú ar thaobh an fhreastalaí.
  • Easpórtáil PDF a chomhtháthú i bhfeidhmchláir SaaS, i bpainéil agus i CMS.
  • Gabhálacha scáileáin de leathanaigh iomlána a chruthú mar cháipéis réidh le priontáil.

Ceisteanna Coitianta

Conas a oibríonn an Web-to-PDF-API?

Seol iarratas POST le { "url": "…" } chuig /api/generate-pdf. Is é an freagra an PDF críochnaithe (application/pdf) – gan comhartha uisce.

An féidir liom HTML a thiontú go PDF in ionad URL?

Is féidir. Bain úsáid as an endpoint /api/html-to-pdf agus seol { "html": "…", "css": "…" }.

Cé mhéad a chosnaíonn an PDF API?

Tá an tús saor in aisce. Ritheann an API go comhlíontach le GDPR ar fhreastalaithe san AE.

Cé na teangacha ríomhchláraithe a dtacaítear leo?

Aon teanga a bhfuil tacaíocht HTTP aici – curl, JavaScript/Node.js, PHP, Python, Java, Go, C# agus tuilleadh.