Forums

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for .NET (v9.x)  /  FormatException: Header checksum illegal

Forum Thread - FormatException: Header checksum illegal

I am working on a project where I am taking a single PDF file, reading the text on each page, adding bookmarks to it, and outputting it into a different folder. I have done this with version 8.x of the Merger with no issues. We recently upgraded to version 9.x (specifically v9.0.0.40 Build 36008) and now when I am calling the GetText() method on the pages I am getting a System.FormatException: Header checksum illegal error. Below is the code I am using:

// Activates our license
RegisterDynamicPdf();

string sourcePdf = @"C:\temp\UnprocessedPdfs\singlePageTest.pdf";
string destinationPdf = @"C:\temp\ProcessedPdfs\singlePageTest.pdf";
PdfDocument doc = new PdfDocument(sourcePdf);
MergeDocument writer;
MergeOptions options = MergeOptions.None;
Outline parentOutline = null;
Outline childOutline;
Regex regex = new Regex(@"\|.+\|");

writer = new MergeDocument(doc, options);

for (int i = 0; i < doc.Pages.Count; i++)
{
        try
        {
                pageText = doc.Pages[i].GetText(); <-- This is throwing the exception
        }
        catch(NullReferenceException nrex)
        {
                // Pages with no text throw this exception. Ignore it
                pageText = "";
        }
        catch(Exception ex)
        {
                Console.WriteLine(ex.ToString());
        }

        // The remainder of the code is for adding the bookmarks in the appropriate place
}

I'm using text on the page to determine what needs to go in the bookmark.
Posted by a ceTe Software moderator
Hello,

We will need to recreate this error on our side to be able to troubleshoot further. Please email the source PDF that is causing this exception to support@cete.com.

Thanks,
ceTe Software Support Team.
Posted by a ceTe Software moderator
Hello,

This issue has been fixed and the latest DynamicPDF for .NET installer is available for download here.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 7:35 AM.