Skip to main content

Class PdfDiagnosticCodes

Namespace: AdCodicem.Pdf.Diagnostics
Assembly: AdCodicem.Pdf.dll

The diagnostic codes the library emits. They are part of the public contract: renaming one is a breaking change, because callers filter and assert on them.

public static class PdfDiagnosticCodes

Inheritance​

object ← PdfDiagnosticCodes

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Fields​

FilterChecksumMismatch​

A Flate stream's data decoded to its end, but the zlib checksum that follows it disagrees with what it decoded to: all of it was kept, as other readers keep it, and some of it may be wrong.

public const string FilterChecksumMismatch = "filter.checksum-mismatch"

Field Value​

string

FilterFailed​

A filter's data is not what the filter says. Data that nothing could decode was left encoded; data that decoded in part — a Flate stream that lost its tail or turned corrupt, an LZW stream that uses a code it has not defined — was kept as far as it went; data read despite a fault that lost nothing, such as a missing zlib header or checksum, is reported as a repair. The message says which, and where a Flate stream's data turned corrupt.

public const string FilterFailed = "filter.failed"

Field Value​

string

FilterUnsupported​

A filter named by the file is not supported, and decoding stopped there: the data is what the filters before it decoded, or the stream's own when it is the first. A /Filter entry that is neither a name nor an array leaves the data as the stream holds it.

public const string FilterUnsupported = "filter.unsupported"

Field Value​

string

HeaderMissing​

The file has no %PDF- header within the bytes the reader searches at its start (ISO 32000-1, 7.5.2): the file was read all the same, its offsets counted from its first byte.

public const string HeaderMissing = "header.missing"

Field Value​

string

LimitDecodedStream​

A stream decodes to more than PdfReaderLimits.MaxDecodedStreamLength, and only the part within it was kept. Like every limit.* code, the guard is the reader's, not damage in the file.

public const string LimitDecodedStream = "limit.decoded-stream"

Field Value​

string

LimitObject​

An object is longer than PdfReaderLimits.MaxObjectLength, and only the part within it was parsed.

public const string LimitObject = "limit.object"

Field Value​

string

LimitTrailer​

A trailer, or a cross-reference stream's dictionary, is longer than PdfReaderLimits.MaxTrailerLength, and only the part within it was parsed.

public const string LimitTrailer = "limit.trailer"

Field Value​

string

LimitXRefSectionCount​

The chain of cross-reference sections is longer than PdfReaderLimits.MaxXRefSectionCount, and the older sections were not read.

public const string LimitXRefSectionCount = "limit.xref-section-count"

Field Value​

string

LimitXRefSectionLength​

A classic cross-reference section is longer than PdfReaderLimits.MaxXRefSectionLength, and only the entries within it were read.

public const string LimitXRefSectionLength = "limit.xref-section-length"

Field Value​

string

ObjectRedefined​

Rebuilding the index met more than one definition of an object number: the file was updated, or copies an object. It is reported once for each rebuild, as information with no position: how many definitions met a number already found, the first ten of those numbers, and which definition was kept — the last written directly in the file, or, for a number written only inside object streams, the first listed in the object stream read first.

public const string ObjectRedefined = "object.redefined"

Field Value​

string

ObjectStreamMemberMoved​

An object is in the object stream its entry names, at another index than the entry gives: the object stream's header lists it elsewhere, and it was read from there. The report is placed where the object stream's data starts, and names the object, the object stream and both indexes.

public const string ObjectStreamMemberMoved = "object-stream.member-moved"

Field Value​

string

ObjectStreamUnreadable​

What an object stream — a stream an entry of the index names as one — says of itself cannot be believed: its /N or its /First is absent or no non-negative integer, its /N declares more objects than its header can list, its /First lies past its decoded data, or its header ends or breaks before listing as many objects as its /N declares — a pair that is not two integers, or that gives a number no object can have or an offset no member can start at. The objects listed before the fault, if any, are read; the others cannot be read from it. The report is placed where the object stream's data starts, and names the object stream and its fault.

public const string ObjectStreamUnreadable = "object-stream.unreadable"

Field Value​

string

StreamLengthInvalid​

A stream's /Length is not where its data ends: its endstream lies elsewhere and ends the data, the /Length gives no length the reader can take and the endstream ends the data, or no endstream follows the declared length — none before the next object or the end of the file, or none looked for once the document's searches read as much of the file as they may — and that length is kept.

public const string StreamLengthInvalid = "stream.length-invalid"

Field Value​

string

StreamSelfReference​

An object stream's dictionary names an object the stream holds — as its /Length, /N, /First, a filter or one of its parameters —, which cannot be read before the stream is: the stream was decoded without it.

public const string StreamSelfReference = "stream.self-reference"

Field Value​

string

StreamTruncated​

A stream has no endstream before the end of the file, or before the endobj that follows its data: its data runs to the end of the file.

public const string StreamTruncated = "stream.truncated"

Field Value​

string

SyntaxDepthExceeded​

Nesting exceeded the depth the reader is willing to follow.

public const string SyntaxDepthExceeded = "syntax.depth-exceeded"

Field Value​

string

SyntaxHexStringInvalid​

A hexadecimal string holds bytes that are neither hexadecimal digits nor white space, the only bytes ISO 32000-1 (7.3.4.3) lets it hold — a % among them, which is no comment there —: they were skipped, as pdf.js and pdfium skip them, where PDFBox stops at the first, MuPDF and poppler read each as the digit 0, and qpdf and pypdf lose the string. Reported once for each string, where its first such byte lies, how many there are in the message; inside an object an object stream holds, where the stream's data starts, the member and the byte in the message.

public const string SyntaxHexStringInvalid = "syntax.hex-string-invalid"

Field Value​

string

SyntaxKeyRepeated​

A dictionary gives a key more than once, which ISO 32000-1 (7.3.7) forbids: keys compare as they read, so a key written with #xx escapes repeats the one written without. The last value given is kept, and a null given last removes the key, as qpdf, pdf.js, PDFBox, MuPDF and pdfium read it; a key given with no value, before >> or endobj, is one given null, and a value a guard's cut leaves short removes nothing. Reported for each key given again, where it is given, unless a window's edge reaches the key itself, the key quoted in the message; inside an object an object stream holds, where the stream's data starts, the member and the byte in the message.

public const string SyntaxKeyRepeated = "syntax.key-repeated"

Field Value​

string

SyntaxNameEscapeInvalid​

A name holds a number sign that two hexadecimal digits do not follow: it was kept as the byte it is, as PDF 1.1 read it and most readers still do, where ISO 32000-1 (7.3.5) has a writer write #23. Reported once for each name, where its first such number sign lies, the name read quoted in the message; inside an object an object stream holds, where the stream's data starts, the member and the byte in the message. A #00 is no such fault: it is an escape, of a byte no name may hold, which the validator reports.

public const string SyntaxNameEscapeInvalid = "syntax.name-escape-invalid"

Field Value​

string

SyntaxNumberOutOfRange​

A number is beyond what a real can hold — its magnitude rounds past the largest a double holds, about 1.8 × 10^308 —: it was read as null, so a dictionary holds no entry for its key. The report quotes the number, and is placed where it starts, or, for a number inside an object an object stream holds, where the stream's data starts, the member and the byte in its message. An integer past the range of a long is no fault of its own: it reads as a real, the one nearest to it.

public const string SyntaxNumberOutOfRange = "syntax.number-out-of-range"

Field Value​

string

SyntaxTruncatedObject​

An object ended before it was whole: the file, or an object stream's decoded data, ended in the middle of it — a value missing, or an array, a dictionary or a string it opened never closed —, or an endobj stood where a value or a key should be, inside an array or a dictionary it opened. What was read is kept: a string takes the bytes to the end of the data, and an endobj ends every container it finds open: the object's own, or, when the object lost it too, the next object's, the container then taking that object. Reported once, for the innermost construct left open, where it opens — where the value would start, when none is open; past the depth the reader follows, the container it skipped, which holds what it did not follow —, the constructs around it counted in the message; inside an object an object stream holds, where the stream's data starts, the member and the byte in the message. The edge of a window the reader grows is no end of the data, and a cut a guard made is the guard's.

public const string SyntaxTruncatedObject = "syntax.truncated-object"

Field Value​

string

SyntaxUnexpectedToken​

A token stood where the syntax does not allow it: where a value or a dictionary key was expected, after a key that has no value, or closing an array with a dictionary's end. It was read as null, skipped, or it ended what it stood in.

public const string SyntaxUnexpectedToken = "syntax.unexpected-token"

Field Value​

string

TrailerRootRecovered​

The trailer's /Root did not lead to a document catalog, and the reader found the catalog among the file's objects: among those the file indexes when its index is sound, in a rebuilt index otherwise.

public const string TrailerRootRecovered = "trailer.root-recovered"

Field Value​

string

XRefChainCycle​

The chain of previous cross-reference sections looped back on itself: a /Prev or /XRefStm names an offset the chain has already reached, read or, outside the file, named. The report is placed at the section the chain looped back to, or at the section whose trailer named it when that offset lies outside the file.

public const string XRefChainCycle = "xref.chain-cycle"

Field Value​

string

XRefEntryOutOfRange​

An object's cross-reference entry places it outside the file. The report carries no position, since the index does not keep where the entry was read; its message gives the offset. A section named outside the file is PdfDiagnosticCodes.XRefSectionMissing's, or the rebuild's when startxref names it.

public const string XRefEntryOutOfRange = "xref.entry-out-of-range"

Field Value​

string

XRefOffsetAdjusted​

An object, or a cross-reference section the chain names, was not at the offset the file claimed, and was found nearby.

public const string XRefOffsetAdjusted = "xref.offset-adjusted"

Field Value​

string

XRefRebuilt​

The cross-reference table was rebuilt by scanning the whole file.

public const string XRefRebuilt = "xref.rebuilt"

Field Value​

string

XRefSectionMissing​

A cross-reference section the chain names, through /Prev or /XRefStm, is neither where it is named nor near it — nothing there reads as a section, which PdfDiagnosticCodes.XRefSectionUnreadable reports otherwise —, lies outside the file, or is named by a value that is not an offset. The objects only it indexes are missing from the index, which is rebuilt by scanning the file when one of them is asked for. The report is placed at the offset the section was named at, or, when that offset lies outside the file or the value is not an offset, at the section whose trailer named it.

public const string XRefSectionMissing = "xref.section-missing"

Field Value​

string

XRefSectionUnreadable​

A cross-reference section the chain names, through /Prev or /XRefStm, is where it is named but cannot be read — a stray token among a table's rows or in place of its trailer, a subsection numbering objects past 2,147,483,647, a cross-reference stream whose /W, /Index, /Size or data cannot give rows —, and nothing near it can be read in its place. The rows read before the fault, if any, were kept; the objects only the rest indexes are missing from the index, which is rebuilt by scanning the file when one of them is asked for. The report is placed at the section, the fault in its message.

public const string XRefSectionUnreadable = "xref.section-unreadable"

Field Value​

string