Created
May 13, 2025 03:00
-
-
Save documentprocessing/9c568f11789e4c68ee2963c70a16595d to your computer and use it in GitHub Desktop.
PDF Metadata Extraction in .NET
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UglyToad.PdfPig; | |
| class PdfInspector | |
| { | |
| public void Inspect(string filePath) | |
| { | |
| using var document = PdfDocument.Open(filePath); | |
| // Document metadata | |
| Console.WriteLine($"Title: {document.Information.Title}"); | |
| Console.WriteLine($"Author: {document.Information.Author}"); | |
| Console.WriteLine($"Created: {document.Information.Created}"); | |
| // Font analysis | |
| foreach (var page in document.GetPages()) | |
| { | |
| var fonts = page.GetFonts(); | |
| Console.WriteLine($"Page {page.Number} uses {fonts.Count} fonts:"); | |
| foreach (var font in fonts) | |
| { | |
| Console.WriteLine($"- {font.Name} ({font.Type})"); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment