Skip to content

Parse tracking metadata

This operation reverses Create tracking metadata by decoding a file-name prefix back into a structured PdfTrackingMetadata instance. A known regex-capture-group defect means imaging intent and conversion type are never correctly recovered.

Field Value
Operation ID OP-13
Trigger Caller invokes PdfTrackingMetadata.Parse(string prefix)
Inputs Tracking prefix string
Outputs Populated PdfTrackingMetadata, or null
Primary components PdfAPI.Core.PdfTrackingMetadata.Parse
Entry point PdfAPI.Core\PdfTrackingMetadata.cs

Steps

  1. Match the prefix against (?<filePrefix>(?<type>.{1})(?<import>.{1})(?<appCode>[^_]+)_(?<fileId>[^\.+_]+))(_(?<fileIndex>\d+))?. (BR-35)
  2. Return null when the pattern does not match. (BR-36)
  3. On a match, populate FilePrefix, ApplicationCode, and FileId (parsed as a Guid). (BR-35)
  4. Set ShouldBeImaged from group importType and ConversionType from group conversionType. (BR-37)
  5. This step reads capture groups named importType and conversionType, but the pattern in step 1 names them import and type. Both lookups therefore always return an empty string, so Parse always yields ShouldBeImaged = false and ConversionType = Convert regardless of the prefix — a defect in live (non-commented) code, not an inference: the group names do not match. (BR-37)

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start(["Parse(prefix)"]) --> Match{Matches tracking<br>prefix pattern?}
    Match -->|No| Null([Return null])
    Match -->|Yes| Populate["Populate FilePrefix,<br>ApplicationCode, FileId"]
    Populate --> Groups["Read importType/conversionType<br>groups (mismatched names)"]
    Groups --> Defect["ShouldBeImaged = false,<br>ConversionType = Convert (always)"]
    Defect --> Return([Return PdfTrackingMetadata])

Failure and edge-case behavior

  • The capture-group mismatch in step 4 means any workflow relying on round-tripping imaging intent or conversion type through the file-name prefix silently loses that data (BR-37).
  • A prefix that does not match the pattern returns null rather than throwing (BR-36).

Sources

  • PdfAPI.Core\PdfTrackingMetadata.cs