API Reference
EpubPublication
A writable EPUB package retaining unknown XML and entry payloads. Instances are mutable and not thread-safe. Use CancellationToken) to project the current publication through the existing extraction owner.
Inheritance
- Object
- EpubPublication
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method EpubPublication.Create
- Method EpubPublication.Load
- Method EpubPublication.Load
- Method EpubPublication.LoadAsync
- Method EpubPublication.LoadAsync
Methods
public EpubManifestItem AddChapter(String id, String containerPath, String title, String xhtmlBody, IEnumerable<String> stylesheets = null, Boolean linear = true) #EpubManifestItemAdds a well-formed XHTML body fragment as a chapter, with a linear spine position and a TOC entry.
Parameters
- id System.String
- containerPath System.String
- title System.String
- xhtmlBody System.String
- stylesheets System.Collections.Generic.IEnumerable{System.String} = null
- linear System.Boolean = true
public Void AddDublinCoreMetadata(String name, String value, String id = null, String language = null) #VoidAdds an ordered Dublin Core value; existing unknown metadata remains intact.
Parameters
- name System.String
- value System.String
- id System.String = null
- language System.String = null
public Void AddMetadataProperty(String property, String value, String refines = null) #VoidAdds an ordered EPUB 3 property value, including repeatable accessibility declarations.
Parameters
- property System.String
- value System.String
- refines System.String = null
public EpubManifestItem AddResource(String id, String containerPath, String mediaType, Byte[] data, String properties = null) #EpubManifestItemAdds a local manifest resource at a canonical container path. Payloads are copied and never executed.
Parameters
- id System.String
- containerPath System.String
- mediaType System.String
- data System.Byte[]
- properties System.String = null
public EpubSpineItem AddSpineItem(String manifestId, Boolean linear = true, String properties = null) #EpubSpineItemAdds a distinct reading position for an existing manifest resource.
Parameters
- manifestId System.String
- linear System.Boolean = true
- properties System.String = null
public EpubManifestItem AddStylesheet(String id, String containerPath, String css) #EpubManifestItemAdds a UTF-8 stylesheet resource.
Parameters
- id System.String
- containerPath System.String
- css System.String
public static EpubPublication Create(String title, String language = "en", String identifier = null, EpubVersion version = Epub3, EpubPublicationLoadOptions retentionLimits = null) #EpubPublicationCreates a publication with stable identity; newly authored packages need at least one linear chapter.
Parameters
- title System.String
- language System.String = "en"
- identifier System.String = null
- version OfficeIMO.Epub.EpubVersion = Epub3
- retentionLimits OfficeIMO.Epub.EpubPublicationLoadOptions = null
public Void DeclareVocabularyPrefix(String prefix, String vocabularyUri) #VoidDeclares a custom vocabulary prefix without replacing other declarations.
Parameters
- prefix System.String
- vocabularyUri System.String
public XDocument GetContentXml(String manifestId) #XDocumentReturns an independent XML content document for targeted editing.
Parameters
- manifestId System.String
public XDocument GetPackageXml() #XDocumentReturns an independent copy of package XML for inspection.
public Byte[] GetResourceBytes(String manifestId) #Byte[]Returns an independent copy of retained resource bytes, including original font-obfuscated bytes.
Parameters
- manifestId System.String
public static EpubPublication Load(Stream stream, EpubPublicationLoadOptions options = null, CancellationToken cancellationToken = default) #EpubPublicationLoads all bounded entries for editing without conflating retained package content with extracted chapters.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Epub.EpubPublicationLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static EpubPublication Load(String path, EpubPublicationLoadOptions options = null, CancellationToken cancellationToken = default) #EpubPublicationLoads a file for bounded package editing.
Parameters
- path System.String
- options OfficeIMO.Epub.EpubPublicationLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static async Task<EpubPublication> LoadAsync(Stream stream, EpubPublicationLoadOptions options = null, CancellationToken cancellationToken = default) #Task<EpubPublication>Asynchronously loads a caller-owned stream for editing.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Epub.EpubPublicationLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static async Task<EpubPublication> LoadAsync(String path, EpubPublicationLoadOptions options = null, CancellationToken cancellationToken = default) #Task<EpubPublication>Asynchronously loads a file for editing.
Parameters
- path System.String
- options OfficeIMO.Epub.EpubPublicationLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void MoveSpineItem(Int32 fromIndex, Int32 toIndex) #VoidMoves a reading position while preserving its attributes and repeated references.
Parameters
- fromIndex System.Int32
- toIndex System.Int32
public EpubDocument Read(EpubReadOptions options = null, CancellationToken cancellationToken = default) #EpubDocumentProjects current authored content through the existing EPUB reader, without executing embedded content.
Parameters
- options OfficeIMO.Epub.EpubReadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void RemoveResource(String manifestId) #VoidRemoves an unreferenced declaration and its payload. Callers must first update content/navigation links.
Parameters
- manifestId System.String
public Void RemoveSpineItem(Int32 index) #VoidRemoves one reading position without deleting its resource.
Parameters
- index System.Int32
public EpubWriteReport Save(String path, EpubWriteOptions options = null, CancellationToken cancellationToken = default) #EpubWriteReportAtomically saves a completed artifact to a file, preserving an existing destination on validation/cancellation failure.
Parameters
- path System.String
- options OfficeIMO.Epub.EpubWriteOptions = null
- cancellationToken System.Threading.CancellationToken = default
public EpubWriteReport Save(Stream stream, EpubWriteOptions options = null, CancellationToken cancellationToken = default) #EpubWriteReportWrites a staged complete artifact to a caller-owned stream. Seekable streams are replaced and rewound.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Epub.EpubWriteOptions = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<EpubWriteReport> SaveAsync(String path, EpubWriteOptions options = null, CancellationToken cancellationToken = default) #Task<EpubWriteReport>Asynchronously atomically saves a completed artifact to a file.
Parameters
- path System.String
- options OfficeIMO.Epub.EpubWriteOptions = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<EpubWriteReport> SaveAsync(Stream stream, EpubWriteOptions options = null, CancellationToken cancellationToken = default) #Task<EpubWriteReport>Asynchronously writes a staged artifact without closing the destination stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Epub.EpubWriteOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void SetContentXml(String manifestId, XDocument content) #VoidReplaces content XML after validating a supported non-scripted XHTML or SVG root.
Parameters
- manifestId System.String
- content System.Xml.Linq.XDocument
public Void SetCoverImage(String manifestId) #VoidSelects a manifest image as the cover, preserving other item properties.
Parameters
- manifestId System.String
public Void SetMetadataProperty(String property, String value, String refines = null) #VoidSets one EPUB 3 property/refinement without replacing unrelated declarations.
Parameters
- property System.String
- value System.String
- refines System.String = null
public Void SetRenditionLayout(EpubRenditionLayout layout) #VoidSets typed package layout metadata. This declares layout; it does not create fixed-page geometry.
Parameters
- layout OfficeIMO.Epub.EpubRenditionLayout
public Void UpdateResource(String manifestId, Byte[] data) #VoidReplaces one local resource payload. Encrypted/obfuscated bytes require an explicit re-keying implementation.
Parameters
- manifestId System.String
- data System.Byte[]
public EpubWriteResult Write(EpubWriteOptions options = null, CancellationToken cancellationToken = default) #EpubWriteResultProduces a complete bounded ZIP before publication. Unedited imports return their exact original bytes.
Parameters
- options OfficeIMO.Epub.EpubWriteOptions = null
- cancellationToken System.Threading.CancellationToken = default
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public String PackagePath { get; } #Selected package document path. Other rootfiles and their payloads are preserved.
public String PackageVersion { get; } #Declared package version, preserved when editing.
public IReadOnlyList<EpubManifestItem> Manifest { get; } #Typed manifest declarations in package order.
public IReadOnlyList<EpubSpineItem> Spine { get; } #Typed reading positions, including repeated resource references.
public IReadOnlyList<String> EntryPaths { get; } #All retained entry paths, including unmanifested extension payloads.
public String Title { get; set; } #Primary title. Other titles and refinements are retained.
public String Language { get; set; } #Primary language. Chapter-level language declarations are edited independently.
public String Identifier { get; set; } #Selected package identity. Identity changes are rejected for obfuscated/encrypted packages.
public String Creator { get; set; } #Primary creator, preserving other contributors and refinements.
public String PageProgressionDirection { get; set; } #Page progression declaration, such as ltr or rtl; null restores the package default.