PublisherDocument
OfficeIMO.Publisher
A managed editable publication, loaded from Publisher or created in memory, with bounded native source saving and SVG export.
Inheritance
- object
- PublisherDocument
Usage
Explore 11 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 3
- Method PublisherDocument.Create
- Method PublisherDocument.Load
- Method PublisherDocument.LoadAsync
Accepted by parameters 8
- Extension method PublisherDocument.SaveAsImages
- Extension method PublisherDocument.SaveAsImagesAsync
- Extension method PublisherDocument.ToImages
- Extension method PublisherDocument.ToImagesAsync
- Method PublisherDocumentImageConversionExtensions.SaveAsImages
- Method PublisherDocumentImageConversionExtensions.SaveAsImagesAsync
- Method PublisherDocumentImageConversionExtensions.ToImages
- Method PublisherDocumentImageConversionExtensions.ToImagesAsync
Methods
public PublisherPicture AddImage(uint pageId, byte[] bytes, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, CancellationToken cancellationToken = default) #Appends an owned static PNG or JPEG picture to a qualified document or master page and returns its committed immutable snapshot. Bounds use physical page-local lengths and positive dimensions.
Parameters
- pageId uint
- bytes byte[]
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherPicturepublic PublisherPicture AddImage(uint pageId, int imageId, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, CancellationToken cancellationToken = default) #Appends an uncropped picture that shares an existing document image asset. Bounds use physical page-local lengths.
Parameters
- pageId uint
- imageId int
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherPicturepublic PublisherTextFrame AddLinkedTextFrame(uint previousFrameId, uint pageId, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, CancellationToken cancellationToken = default) #Appends a new continuation frame to an existing resolved non-table story, on an existing document page. Returns the current snapshot of the new frame.
Parameters
- previousFrameId uint
- pageId uint
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherTextFramepublic PublisherPage AddMasterPage(string name, CancellationToken cancellationToken = default) #Appends an empty centered single-page master at the publication's existing size, returning its committed immutable snapshot. The name must contain non-control text.
Parameters
- name string
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherPagepublic ValueTuple<PublisherPage, PublisherPage> AddMasterPagePair(string name, CancellationToken cancellationToken = default) #Appends both definitions of a two-page master atomically and returns their committed immutable snapshots.
Parameters
- name string
- cancellationToken System.Threading.CancellationToken = default
Returns
ValueTuple<PublisherPage, PublisherPage>public PublisherPage AddPage(uint? masterPageId = null, CancellationToken cancellationToken = default) #Appends an empty document page at the publication's existing size. A null master identifier means no applied master. Returns the committed immutable page snapshot.
Parameters
- masterPageId uint? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherPagepublic PublisherShape AddShape(uint pageId, OfficeShape shape, OfficeLength x, OfficeLength y, CancellationToken cancellationToken = default) #Appends a rectangle, rounded rectangle, ellipse or nondegenerate line to an existing document or master page, returning its current immutable snapshot.
Parameters
- pageId uint
- shape OfficeIMO.Drawing.OfficeShape
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherShapepublic PublisherTable AddTable(uint pageId, OfficeLength x, OfficeLength y, IReadOnlyList<OfficeLength> columnWidths, IReadOnlyList<OfficeLength> rowHeights, CancellationToken cancellationToken = default) #Appends an empty, unmerged, borderless table to an existing qualified document or master page. Track sizes and offsets use physical lengths. Returns the current immutable snapshot.
Parameters
- pageId uint
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- columnWidths System.Collections.Generic.IReadOnlyList<OfficeIMO.OfficeLength>
- rowHeights System.Collections.Generic.IReadOnlyList<OfficeIMO.OfficeLength>
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherTablepublic PublisherTextFrame AddTextFrame(uint pageId, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, IReadOnlyList<OfficeRichTextParagraph> paragraphs, CancellationToken cancellationToken = default) #Appends an independent styled text frame and complete story to a qualified document or master page. Bounds are page-local physical lengths; dimensions must be positive. Returns the committed immutable frame snapshot.
Parameters
- pageId uint
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- paragraphs System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeRichTextParagraph>
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherTextFramepublic static PublisherDocument Create(PublisherCreateOptions? options = null, CancellationToken cancellationToken = default) #Creates an in-memory publication with one empty document page, defaulting to A4 portrait, no applied master and no native source.
Parameters
- options OfficeIMO.Publisher.PublisherCreateOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherDocumentpublic static PublisherDocument Create(OfficeLength width, OfficeLength height, PublisherCreateOptions? options = null, CancellationToken cancellationToken = default) #Creates an in-memory publication with one empty document page at the given positive physical dimensions, no applied master and no native source.
Parameters
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- options OfficeIMO.Publisher.PublisherCreateOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherDocumentpublic void Dispose() #Completes the document lifetime without changing detached snapshots or disposing caller-owned codecs and font providers. No owned handles are retained.
public static PublisherDocument Load(string path, PublisherLoadOptions? options = null, CancellationToken cancellationToken = default) #Loads a publication from a file without retaining file handles.
Parameters
- path string
- options OfficeIMO.Publisher.PublisherLoadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherDocumentpublic static PublisherDocument Load(byte[] bytes, PublisherLoadOptions? options = null, CancellationToken cancellationToken = default) #Loads bounded native publication bytes. Unsupported generations and malformed records are rejected.
Parameters
- bytes byte[]
- options OfficeIMO.Publisher.PublisherLoadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherDocumentpublic static PublisherDocument Load(Stream stream, PublisherLoadOptions? options = null, CancellationToken cancellationToken = default) #Reads from the current position to EOF, leaving the caller's stream open. Non-seekable streams are supported.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Publisher.PublisherLoadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherDocumentpublic static async Task<PublisherDocument> LoadAsync(string path, PublisherLoadOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously reads bounded publication bytes from a file, then parses and projects them with cancellation. No file handle is retained.
Parameters
- path string
- options OfficeIMO.Publisher.PublisherLoadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<PublisherDocument>public static async Task<PublisherDocument> LoadAsync(Stream stream, PublisherLoadOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously reads bounded native bytes from the current position to EOF, then parses and projects them. Caller-owned and non-seekable streams remain open.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Publisher.PublisherLoadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<PublisherDocument>public void MergeTableCells(uint tableId, int firstRow, int firstColumn, int rowCount, int columnCount, CancellationToken cancellationToken = default) #Merges a rectangular range of complete cells in an authored table, using zero-based coordinates and positive row and column counts.
Parameters
- tableId uint
- firstRow int
- firstColumn int
- rowCount int
- columnCount int
- cancellationToken System.Threading.CancellationToken = default
public void ReplacePictureImage(uint pictureId, byte[] bytes, CancellationToken cancellationToken = default) #Replaces one supported picture placement's embedded image with owned PNG or JPEG bytes. Other placements sharing its old asset remain unchanged.
Parameters
- pictureId uint
- bytes byte[]
- cancellationToken System.Threading.CancellationToken = default
public void ReplaceStoryParagraphs(uint storyId, IReadOnlyList<OfficeRichTextParagraph> paragraphs, CancellationToken cancellationToken = default) #Replaces a non-table story's styled paragraphs and recalculates its page layout. IDs and frame links are retained. Fetch current pages, stories and frames after an edit; previously returned objects remain snapshots.
Parameters
- storyId uint
- paragraphs System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeRichTextParagraph>
- cancellationToken System.Threading.CancellationToken = default
public void ReplaceTableCellParagraphs(uint tableId, int rowIndex, int columnIndex, IReadOnlyList<OfficeRichTextParagraph> paragraphs, CancellationToken cancellationToken = default) #Replaces the styled paragraphs of the cell anchored at the given zero-based grid coordinates. Other cells, merged ownership and the complete story remain intact.
Parameters
- tableId uint
- rowIndex int
- columnIndex int
- paragraphs System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeRichTextParagraph>
- cancellationToken System.Threading.CancellationToken = default
public PublisherSaveReport Save(PublisherSaveOptions? options = null, CancellationToken cancellationToken = default) #Atomically saves to the associated native path, replacing that file by default. Explicit settings retain their selected conflict policy.
Parameters
- options OfficeIMO.Publisher.PublisherSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherSaveReportpublic PublisherSaveReport Save(string path, PublisherSaveOptions? options = null, CancellationToken cancellationToken = default) #Prepares a complete native PUB and atomically publishes it to an explicit .pub path.
Parameters
- path string
- options OfficeIMO.Publisher.PublisherSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherSaveReportpublic PublisherSaveReport Save(Stream stream, PublisherSaveOptions? options = null, CancellationToken cancellationToken = default) #Prepares native PUB bytes before writing a caller-owned stream, which remains open.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Publisher.PublisherSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
PublisherSaveReportpublic Task<PublisherSaveReport> SaveAsync(PublisherSaveOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously stages and atomically saves to the associated native path, replacing that file by default. Explicit settings retain their selected conflict policy.
Parameters
- options OfficeIMO.Publisher.PublisherSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<PublisherSaveReport>public async Task<PublisherSaveReport> SaveAsync(string path, PublisherSaveOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously stages and atomically publishes a complete native PUB to an explicit .pub path.
Parameters
- path string
- options OfficeIMO.Publisher.PublisherSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<PublisherSaveReport>public async Task<PublisherSaveReport> SaveAsync(Stream stream, PublisherSaveOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously writes a complete native PUB to a caller-owned stream without closing it.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Publisher.PublisherSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<PublisherSaveReport>public void SetPageMaster(uint pageId, uint? masterPageId, CancellationToken cancellationToken = default) #Assigns a qualified direct master to a document page, or clears the assignment when the master identifier is null. Inherited objects remain owned once by their master.
Parameters
- pageId uint
- masterPageId uint?
- cancellationToken System.Threading.CancellationToken = default
public void SetPageObjectOrder(uint pageId, IReadOnlyList<uint> objectIds, CancellationToken cancellationToken = default) #Sets an existing document or master page's back-to-front object order. Supply every identifier from its current PublisherPage.ObjectIds exactly once.
Parameters
- pageId uint
- objectIds System.Collections.Generic.IReadOnlyList<uint>
- cancellationToken System.Threading.CancellationToken = default
public void SetPictureBounds(uint pictureId, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, CancellationToken cancellationToken = default) #Sets a supported picture's physical page-local bounds. Negative offsets allow page-clipped bleed; width and height must be positive.
Parameters
- pictureId uint
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
public void SetPictureCrop(uint pictureId, OfficeImageSourceCrop crop, CancellationToken cancellationToken = default) #Sets normalized source-edge crop fractions on one supported picture without changing its frame or embedded image.
Parameters
- pictureId uint
- crop OfficeIMO.Drawing.OfficeImageSourceCrop
- cancellationToken System.Threading.CancellationToken = default
public void SetShapeBounds(uint shapeId, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, CancellationToken cancellationToken = default) #Moves or resizes supported vector artwork using physical page-local bounds. Text-capable artwork shares its current placement with the text frame of the same ID.
Parameters
- shapeId uint
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
public void SetShapePaint(uint shapeId, OfficeColor? fillColor, OfficeColor? strokeColor, OfficeLength? strokeWidth = null, double fillOpacity = 1, double strokeOpacity = 1, CancellationToken cancellationToken = default) #Replaces the supported shape's basic solid fill and outline. Null colors disable that paint; physical stroke width defaults to one point and opacities must be between zero and one.
Parameters
- shapeId uint
- fillColor OfficeIMO.OfficeColor?
- strokeColor OfficeIMO.OfficeColor?
- strokeWidth OfficeIMO.OfficeLength? = null
- fillOpacity double = 1
- strokeOpacity double = 1
- cancellationToken System.Threading.CancellationToken = default
public void SetStoryAutomaticHyphenation(uint storyId, bool enabled, CancellationToken cancellationToken = default) #Sets an ordinary story's native automatic-hyphenation flag without changing its source text or formatting.
Parameters
- storyId uint
- enabled bool
- cancellationToken System.Threading.CancellationToken = default
public void SetTableBorderStyle(uint tableId, int firstRow, int firstColumn, int lastRow, int lastColumn, OfficeBorderSide? side, CancellationToken cancellationToken = default) #Assigns an opaque solid border, or clears it with null, along an ordered horizontal or vertical range of grid boundaries.
Parameters
- tableId uint
- firstRow int
- firstColumn int
- lastRow int
- lastColumn int
- side OfficeIMO.Drawing.OfficeBorderSide?
- cancellationToken System.Threading.CancellationToken = default
public void SetTableBounds(uint tableId, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, CancellationToken cancellationToken = default) #Moves and proportionally resizes a qualified table using physical page-local bounds, scaling its column and row tracks by the frame's width and height ratios.
Parameters
- tableId uint
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
public void SetTableCellFillColor(uint tableId, int rowIndex, int columnIndex, OfficeColor? color, CancellationToken cancellationToken = default) #Sets the opaque solid fill, or clears the fill, of the cell anchored at the given zero-based coordinates.
Parameters
- tableId uint
- rowIndex int
- columnIndex int
- color OfficeIMO.OfficeColor?
- cancellationToken System.Threading.CancellationToken = default
public void SetTextFrameBounds(uint frameId, OfficeLength x, OfficeLength y, OfficeLength width, OfficeLength height, CancellationToken cancellationToken = default) #Sets a visible, resolved, untransformed top-level text frame's physical page-local bounds and recalculates the publication. Negative page offsets allow clipped bleed; width and height must be positive.
Parameters
- frameId uint
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- cancellationToken System.Threading.CancellationToken = default
public void SetTextFrameLayout(uint frameId, int columnCount, OfficeLength columnSpacing, OfficeTextPadding padding, OfficeTextVerticalAlignment verticalAlignment, CancellationToken cancellationToken = default) #Replaces a qualified text frame's column count, physical gap, insets and vertical alignment, then recalculates current text ranges, overflow and page scenes. Padding retains its drawing-owned point coordinates.
Parameters
- frameId uint
- columnCount int
- columnSpacing OfficeIMO.OfficeLength
- padding OfficeIMO.Drawing.OfficeTextPadding
- verticalAlignment OfficeIMO.Drawing.OfficeTextVerticalAlignment
- cancellationToken System.Threading.CancellationToken = default
public byte[] ToBytes(PublisherSaveOptions? options = null, CancellationToken cancellationToken = default) #Prepares caller-owned native PUB bytes under the selected loss policy.
Parameters
- options OfficeIMO.Publisher.PublisherSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
byte[]public byte[] ToBytes(PublisherSaveOptions? options, out PublisherSaveReport report, CancellationToken cancellationToken = default) #Prepares caller-owned native PUB bytes and returns the save report.
Parameters
- options OfficeIMO.Publisher.PublisherSaveOptions?
- report OfficeIMO.Publisher.PublisherSaveReport
- cancellationToken System.Threading.CancellationToken = default
Returns
byte[]public string ToSvg(int pageIndex, PublisherSvgOptions? options, out OfficeConversionReport report, CancellationToken cancellationToken = default) #Exports one document page, selected by zero-based index, with combined source and rendering diagnostics.
Parameters
- pageIndex int
- options OfficeIMO.Publisher.PublisherSvgOptions?
- report OfficeIMO.OfficeConversionReport
- cancellationToken System.Threading.CancellationToken = default
Returns
stringpublic string ToSvg(int pageIndex = 0, PublisherSvgOptions? options = null, CancellationToken cancellationToken = default) #Exports one document page as SVG. Use the report overload to inspect source and rendering losses before accepting output.
Parameters
- pageIndex int = 0
- options OfficeIMO.Publisher.PublisherSvgOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
stringInherited Methods
Properties
public bool HasNativeSource { get; } #Whether this document was loaded from native publication bytes. In-memory edits and added pages do not change this provenance.
public string? FilePath { get; private set; } #Absolute path of the loaded file or most recent successful native path save. Stream operations do not associate a path.
public IReadOnlyList<PublisherPage> Pages { get; private set; } #Document pages in current publication order. Utility pages and master definitions are excluded.
public IReadOnlyList<PublisherPage> MasterPages { get; private set; } #Current master definitions, also projected onto their referring document pages.
public IReadOnlyList<PublisherTextStory> TextStories { get; private set; } #Complete current text stories, including authored stories and content whose placement could not be reconstructed.
public IReadOnlyList<PublisherImage> Images { get; private set; } #Recovered embedded image payloads.
public PublisherReadReport ReadReport { get; private set; } #Source decoding and current page reconstruction report. Successful edits replace this snapshot with fresh projection evidence.
public PublisherReadReport SourceReadReport { get; private set; } #Immutable native decoding evidence captured before the initial page projection, or zero source evidence for source-free creation. Edits do not replace this snapshot.
Extension Methods
public static OfficeConversionReport SaveAsImages(PublisherDocument document, string folderPath, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #Saves selected pages with atomic files, bounded output and fidelity acceptance.
Parameters
- document OfficeIMO.Publisher.PublisherDocument
- folderPath string
- options OfficeIMO.Drawing.OfficeImageExportOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
OfficeConversionReportpublic static async Task<OfficeConversionReport> SaveAsImagesAsync(PublisherDocument document, string folderPath, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #Saves selected pages asynchronously without retaining completed image payloads.
Parameters
- document OfficeIMO.Publisher.PublisherDocument
- folderPath string
- options OfficeIMO.Drawing.OfficeImageExportOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<OfficeConversionReport>public static IReadOnlyList<OfficeImageExportResult> ToImages(PublisherDocument document, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #Renders selected source pages in caller order, retaining source and encoding diagnostics.
Parameters
- document OfficeIMO.Publisher.PublisherDocument
- options OfficeIMO.Drawing.OfficeImageExportOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<OfficeImageExportResult>public static void ToImages(PublisherDocument document, OfficeImageExportConsumer consumer, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #Streams selected images without retaining earlier encoded payloads.
Parameters
- document OfficeIMO.Publisher.PublisherDocument
- consumer OfficeIMO.Drawing.OfficeImageExportConsumer
- options OfficeIMO.Drawing.OfficeImageExportOptions? = null
- cancellationToken System.Threading.CancellationToken = default
public static Task<IReadOnlyList<OfficeImageExportResult>> ToImagesAsync(PublisherDocument document, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #Renders selected source pages asynchronously with shared cancellation and deadlines.
Parameters
- document OfficeIMO.Publisher.PublisherDocument
- options OfficeIMO.Drawing.OfficeImageExportOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<IReadOnlyList<OfficeImageExportResult>>