Skip to content

OpenHtmlToPdf

reference
1 min readUpdated

Kind: Service

Source: Pams/API/Pams.API/Pams.API.csproj (line 1)

Part of: Pams

NuGet package dependency

OpenHtmlToPdf is a NuGet package dependency declared in Pams.API.csproj. The Pams API uses the package when application code converts HTML content into PDF output for API consumers.

Diagram

mermaid
sequenceDiagram
    participant Client
    participant API as Pams API
    participant Converter as OpenHtmlToPdf
    participant PDF as PDF Output

    Client->>API: Send request with HTML content
    API->>Converter: Convert HTML to PDF
    Converter-->>API: Return PDF data
    API-->>Client: Return PDF response

Usage

ts
const response = await fetch("/api/pdf", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    html: "<h1>Report</h1><p>Generated from HTML.</p>",
  }),
});

if (!response.ok) {
  throw new Error("PDF generation failed");
}

const pdfBlob = await response.blob();
const url = URL.createObjectURL(pdfBlob);

window.open(url, "_blank");

AI Coding Instructions

  • Keep the OpenHtmlToPdf package reference in Pams.API.csproj aligned with code that performs HTML-to-PDF conversion.
  • Validate HTML input before passing it to PDF conversion code.
  • Return PDF responses with an appropriate PDF content type and attachment behavior when required.
  • Keep API request and response models separate from package-specific conversion types.

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.APIPams/API/Pams.API/Pams.API.csproj:1

Was this page helpful?

Download as PDF