Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: A TrueType table tag must be a uint32, 4 bytes long, instead got: Ĉ(�. (Parameter 'tag') #483

Closed
khanshahan opened this issue Aug 27, 2022 · 2 comments

Comments

@khanshahan
Copy link

Hi,

I am trying to read the file https://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_pdf/40/17/TONIJ-5-206.PMC3257183.pdf but I am getting an exception "A TrueType table tag must be a uint32, 4 bytes long, instead got: Ĉ(�. (Parameter 'tag')".

The error is encountered when going through Pages.

I am using Nuget package 0.1.7-alpha-20220814-2f9a9
.NET 6.0

I am using the following code :
NOTE: pdfStream is a memory stream. Position=0 has already been set.
The same code works for the file "https://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_pdf/db/77/ymj-47-432.PMC2688166.pdf"

        public string GetPDFText(Stream pdfStream)
        {
            StringBuilder stringBuilder = new StringBuilder();
            var pageCount = 0;
            
            using (PdfDocument document = PdfDocument.Open(pdfStream))
            {
                var pages = document.GetPages();
                foreach (Page page in pages)
                {
                    string pageText = page.Text;
                    stringBuilder.Append(" " + pageText);
                    pageCount++;
                }
            }
            return stringBuilder.ToString(); 
        }

@khanshahan
Copy link
Author

HI,

Just wondering did you have a chance to look in this problem ?

@EliotJones
Copy link
Member

This file was corrupt on page 3 according to Adobe Reader. The SkipMissingFonts option has been broadened in scope to account for broken files like this, it should be available in tonight's build. e.g.

using (var document = PdfDocument.Open(file, new ParsingOptions { SkipMissingFonts = true}))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants