Show / Hide Table of Contents

Class ContentReaderOptions

Various options to configure the behavior of the EPUB content reader which is used for loading local content files.

Inheritance
object
ContentReaderOptions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VersOne.Epub.Options
Assembly: VersOne.Epub.dll
Syntax
public class ContentReaderOptions

Constructors

View Source

ContentReaderOptions(EpubReaderOptionsPreset?)

Initializes a new instance of the ContentReaderOptions class.

Declaration
public ContentReaderOptions(EpubReaderOptionsPreset? preset = null)
Parameters
Type Name Description
EpubReaderOptionsPreset? preset

An optional preset to initialize the ContentReaderOptions class with a predefined set of options.

Properties

View Source

IgnoreFileIsTooLargeError

Gets or sets a value indicating whether the content reader should ignore the error when a local content file is larger than 2 GB.

If it's set to false and the local content file referenced by a manifest item is larger than 2 GB, then the "EPUB parsing error: file ... is larger than 2 GB." exception will be thrown. This exception can be suppressed by setting this property to true, in which case the content reader will ignore the error and will treat the large content file as an empty file.

Default value is false.

Declaration
public bool IgnoreFileIsTooLargeError { get; set; }
Property type: bool
View Source

IgnoreMissingFileError

Gets or sets a value indicating whether the content reader should ignore the error when a local content file is listed in the EPUB manifest, but the reader is unable to find it in the EPUB archive.

If it's set to false and the local content file referenced by a manifest item is missing, and the exception was not suppressed by the ContentFileMissing event handler, then the "EPUB parsing error: file ... was not found in the EPUB file." exception will be thrown. This exception can be suppressed by setting this property to true, in which case the content reader will ignore the error and will treat the missing content file as an existing empty file.

Default value is false.

Declaration
public bool IgnoreMissingFileError { get; set; }
Property type: bool
View Source

IgnoreRemoteEpub3NavigationFileError

Gets or sets a value indicating whether the content reader should ignore the error when the EPUB 3 navigation manifest item is referencing a remote resource.

If it's set to false and the content file referenced by the navigation manifest item is a remote resource (i.e. the 'href' attribute of the manifest item is a remote URL), then the "Incorrect EPUB manifest: EPUB 3 navigation document ... cannot be a remote resource." exception will be thrown. This exception can be suppressed by setting this property to true, in which case the content reader will ignore the error. The navigation content file will still be added to the collection of remote HTML/XHTML content files, even if the error was ignored.

Default value is false.

Declaration
public bool IgnoreRemoteEpub3NavigationFileError { get; set; }
Property type: bool
View Source

SkipItemsWithDuplicateFilePaths

Gets or sets a value indicating whether the content reader should skip local content files with duplicate file paths.

If it's set to false and a local content file with a duplicate file path is found in the EPUB manifest, then the "Incorrect EPUB manifest: item with absolute file path = ... is not unique." exception will be thrown. This exception can be suppressed by setting this property to true, in which case only the first file within each duplicate item set will be added to the EpubContentCollection<TLocalContentFile, TRemoteContentFile> or the EpubContentCollectionRef<TLocalContentFileRef, TRemoteContentFileRef> collections and the others will be skipped.

Most content files with duplicate file paths will also have duplicate href values which will be handled by the SkipItemsWithDuplicateHrefs configuration option. However, it is possible for two content files to have different relative paths in their 'href' attributes that point to the same absolute path (e.g. 'Chapters/chapter1.html' and '../Content/Chapters/chapter1.html', assuming that the package file is located inside the 'Content' directory).

Default value is false.

Declaration
public bool SkipItemsWithDuplicateFilePaths { get; set; }
Property type: bool
View Source

SkipItemsWithDuplicateHrefs

Gets or sets a value indicating whether the content reader should skip local content files with duplicate href values.

If it's set to false and a local content file with a duplicate href is found in the EPUB manifest, then the "Incorrect EPUB manifest: item with href = ... is not unique." exception will be thrown. This exception can be suppressed by setting this property to true, in which case only the first file within each duplicate item set will be added to the EpubContentCollection<TLocalContentFile, TRemoteContentFile> or the EpubContentCollectionRef<TLocalContentFileRef, TRemoteContentFileRef> collections and the others will be skipped.

Default value is false.

Declaration
public bool SkipItemsWithDuplicateHrefs { get; set; }
Property type: bool
View Source

SkipItemsWithDuplicateUrls

Gets or sets a value indicating whether the content reader should skip remote content files with duplicate URLs.

If it's set to false and a remote content file with a duplicate URL is found in the EPUB manifest, then the "Incorrect EPUB manifest: item with href = ... is not unique." exception will be thrown. This exception can be suppressed by setting this property to true, in which case only the first file within each duplicate item set will be added to the EpubContentCollection<TLocalContentFile, TRemoteContentFile> or the EpubContentCollectionRef<TLocalContentFileRef, TRemoteContentFileRef> collections and the others will be skipped.

Default value is false.

Declaration
public bool SkipItemsWithDuplicateUrls { get; set; }
Property type: bool

Events

View Source

ContentFileMissing

Occurs when a local content file is listed in the EPUB manifest, but the content reader is unable to find it in the EPUB archive. This event lets the application to be notified of such errors and to decide how EPUB content reader should handle the missing file.

Setting IgnoreMissingFileError property to true does not prevent this event from being fired.

Declaration
public event EventHandler<ContentFileMissingEventArgs>? ContentFileMissing
Event type: EventHandler<ContentFileMissingEventArgs>
  • View Source
In this article
Back to top Generated by DocFX