Skip to content

Commit

Permalink
Update OptionalContentGroupElement.cs
Browse files Browse the repository at this point in the history
Add HexToken case in OptionalContent parsing
  • Loading branch information
simonedd authored and BobLd committed Jan 14, 2025
1 parent f86cc58 commit 1ca52f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/UglyToad.PdfPig/Content/OptionalContentGroupElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ internal OptionalContentGroupElement(MarkedContentElement markedContentElement,
{
Name = nameStr.Data;
}
else if (markedContentElement.Properties.TryGet(NameToken.Name, pdfTokenScanner, out HexToken? nameHex))
{
Name = nameHex.Data;
}
else
{
throw new ArgumentException($"Cannot parse optional content's {nameof(Name)} from {nameof(markedContentElement.Properties)}. This is a required field.", nameof(markedContentElement.Properties));
Expand Down

0 comments on commit 1ca52f4

Please sign in to comment.