# itextsharp

**Kind:** Service

**Source:** `Pams/Core/Pams.Core/Pams.Core.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`itextsharp` is a NuGet package dependency in `Pams.Core` for creating and reading PDF documents in the legacy project format. Code in the core project can use it when a workflow needs to generate, inspect, or modify PDF content.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant PamsCore as Pams.Core
    participant iTextSharp
    participant Pdf as PDF Document

    Client->>PamsCore: Request PDF operation
    PamsCore->>iTextSharp: Create or read document
    iTextSharp->>Pdf: Write or parse PDF content
    Pdf-->>iTextSharp: Document data
    iTextSharp-->>PamsCore: PDF result
    PamsCore-->>Client: Return PDF response
```

## Usage

```ts
async function downloadReport(reportId: string): Promise<Blob> {
  const response = await fetch(`/api/reports/${reportId}/pdf`);

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

  return response.blob();
}

const pdf = await downloadReport("report-id");
const url = URL.createObjectURL(pdf);
window.open(url, "_blank");
```

## AI Coding Instructions

- Treat `itextsharp` as a dependency of `Pams.Core`; keep PDF generation and parsing logic in the .NET project.
- Return generated PDF files from an API endpoint with an appropriate PDF content type.
- Dispose document streams, readers, and writers after PDF operations complete.
- Preserve compatibility with the legacy project format when changing package references or PDF-related code.

## 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.Core` — `Pams/Core/Pams.Core/Pams.Core.csproj`:1
