Skip to content

OP-GET-PDF-VERSION: Get PDF version

Validates a submitted PDF and returns its version header (e.g. 1.7), or an empty string when no header match is found.

Field Value
Operation ID OP-GET-PDF-VERSION
Trigger Client submits POST v1/info/version with PDF bytes
Entry endpoint POST v1/info/version
Owning component InfoController.Version(byte[]) → PdfClientService.Version(byte[])
Inputs Request body: byte[] PDF
Outputs Bare string (version, or "" when no header match)
Failure response No try/catch on this action — any exception produces framework exception detail (IncludeErrorDetailPolicy.Always) before ApiResponseHandler runs; the final client-visible envelope is unknown** (see Endpoints: Error response shape)

Steps

  1. PdfClientService.Version validates the %PDF- file signature before reading the version header (BR-PDFAPI-005).
  2. On failure: a PdfException is thrown reporting that the file is not a valid PDF document (exact message text is not visible in this repository); no try/catch on this action, so it escapes to the framework, producing exception detail (IncludeErrorDetailPolicy.Always) before ApiResponseHandler runs; the final client-visible envelope is unknown**.

This logic is implemented in PdfAPI.Core (PdfClientService.Version), documented in full at Read PDF version (OP-04); its behavior is summarized here only as observed on this request path.

Origin: The PDF-signature validation and version-header parsing behavior described in this step is implemented in PdfAPI.Core, not in PdfAPI. See the linked operation page for the full delegated logic. 2. The version string is parsed from the PDF header, returning "" if no header match is found. 3. The bare string is returned — HTTP 200.

Process flow

The following diagram shows the validation and version-parsing sequence.

flowchart TD
    A["POST v1/info/version"] --> B["ValidatePdf: check file signature"]
    B -->|Invalid| C["PdfException escapes to framework: 500"]
    B -->|Valid| D["Parse version header"]
    D --> E["Return string, 200"]

Transaction and side effects

Aspect Finding
Unit of work None
Commit point Not applicable — no database access
Records written None
Downstream calls None
Repeat-call behavior Read-only; safe to repeat

Logging

Surface Written content
— No dedicated logging observed on this path beyond framework-level exception logging on an uncaught failure

Error handling

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • PdfAPI\Controllers\v1\InfoController.cs
  • PdfAPI.Core\Services\PdfClientService.cs