Kind: Service
Source: Pams/API/Pams.API/Pams.API.csproj (line 1)
Part of: Pams
NuGet package dependency
Select.HtmlToPdf is a NuGet package dependency in Pams.API for converting HTML content into PDF documents. The API can use it when an endpoint needs to return generated PDF output from server-side HTML.
Diagram
mermaidsequenceDiagram participant Client participant PamsAPI as Pams.API participant HtmlToPdf as Select.HtmlToPdf Client->>PamsAPI: Request PDF document PamsAPI->>HtmlToPdf: Convert HTML to PDF HtmlToPdf-->>PamsAPI: PDF bytes PamsAPI-->>Client: application/pdf response
Usage
tsconst response = await fetch("/api/documents/pdf", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
html: "<h1>Document</h1><p>Generated by Pams.API.</p>",
}),
});
if (!response.ok) {
throw new Error("PDF generation failed");
}
const pdfBlob = await response.blob();
const pdfUrl = URL.createObjectURL(pdfBlob);
window.open(pdfUrl, "_blank");
AI Coding Instructions
- Keep
Select.HtmlToPdfusage insidePams.API; browser clients should request PDF output through an API endpoint. - Validate or sanitize HTML input before passing it to PDF conversion.
- Return generated files with an
application/pdfcontent type and a suitable download filename when needed. - Handle conversion failures in the API and return an error response instead of partial PDF content.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Injected or called by (1)
Pams.API—Pams/API/Pams.API/Pams.API.csproj:1
Was this page helpful?