HtmlPdfExportOptions
OfficeIMO.Html.Pdf
Controls direct HTML layout and PDF generation. Layout, resource, page, and safety settings are inherited from HtmlRenderOptions.
Inheritance
- HtmlRenderOptions
- HtmlPdfExportOptions
Usage
Explore 9 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 4
Accepted by parameters 5
Examples
var options = new HtmlPdfExportOptions {
PageSize = OfficePageSizes.A4,
Margins = HtmlRenderMargins.All(32),
DefaultFontFamily = "Arial"
};
using var pdf = HtmlConversionDocument.Parse(html).ToPdf(options);Constructors
public HtmlPdfExportOptions() #Creates direct paged HTML-to-PDF options using the standard defaults.
public HtmlPdfExportOptions(HtmlRenderOptions renderOptions) #Creates PDF-capable options from shared HTML rendering settings without changing their layout mode. PDF conversion enforces paged layout on its own conversion snapshot.
Parameters
- renderOptions OfficeIMO.Html.HtmlRenderOptions
- Shared settings used by PNG, SVG, and PDF rendering.
Methods
public override HtmlRenderOptions Clone() #Creates an independent options snapshot.
Returns
HtmlRenderOptionspublic HtmlPdfExportOptions ClonePdf() #Creates an independent options snapshot for one PDF conversion.
Returns
HtmlPdfExportOptionspublic static HtmlPdfExportOptions ForImageExport(HtmlRenderOptions? source) #Creates options for PNG, JPEG, TIFF, WebP or SVG render requests from shared render options. Text is measured and painted through the PDF engine, while the URL and resource policy of source stays authoritative instead of HtmlPdfExportOptions.ResourcePolicy. PDF-capable options are returned unchanged.
Parameters
- source OfficeIMO.Html.HtmlRenderOptions?
- Shared render options, or null for the defaults.
Returns
HtmlPdfExportOptionspublic HtmlPdfResourcePolicySummary GetResourcePolicySummary() #Returns a snapshot of the active HTML resource policy.
Returns
HtmlPdfResourcePolicySummaryInherited Methods
public OfficeImageExportResult EnsureAccepted(OfficeImageExportResult result) #Parameters
- result OfficeImageExportResult
Returns
OfficeImageExportResultpublic double GetEffectiveScale(double logicalWidth, double logicalHeight) #Parameters
- logicalWidth double
- logicalHeight double
Returns
doublepublic HtmlRenderOptions UseBrowserUserAgentStyles() #Returns
HtmlRenderOptionspublic HtmlRenderOptions UseTextHyphenationLexicon(OfficeTextHyphenationLexicon? lexicon) #Parameters
- lexicon OfficeTextHyphenationLexicon?
Returns
HtmlRenderOptionsProperties
public PdfTextFallbackFeatures TextFallbacks { get; set; } #OfficeIMO-managed font fallback groups used by generated PDF text.
public PdfTextShapingMode TextShapingMode { get; set; } #Dependency-free shaping mode used by generated PDF text.
public PdfEmbeddedFontFamily? FontFamily { get; set; } #Optional caller-supplied embedded font family used by generated PDF text.
public bool InteractiveFormControls { get; set; } #Converts supported standard HTML inputs, text areas, and selects into interactive AcroForm fields. Disable this to retain the shared renderer's static control paint in the PDF.
public DateTimeOffset? MathMlSourceModificationDate { get; set; } #Optional caller-supplied modification date for generated Formula MathML associated files.
public bool AutoFitWidePrintContent { get; set; } #Fits visible layout overflow, including fixed-width descendants and tables, into a uniform CSS print page. Clipped descendants and paint-only shadows do not widen the layout. Fitting retains the physical CSS media context and uses bounded reflow. Named and page-specific rules require an explicit fitting width. Set to false to retain unscaled print layout. An explicit HtmlPdfExportOptions.PrintLayoutWidthCssPixels takes precedence.
public double? PrintLayoutWidthCssPixels { get; set; } #Optional wider CSS layout width for print-to-page fitting. The PDF keeps HtmlRenderOptions.PageSize as its physical size while the paged layout is uniformly reduced to fit its width. CSS media queries and responsive resource selection continue to use HtmlRenderOptions.ViewportWidth. When HtmlRenderOptions.HonorCssPageRules is true, the resolved authored page size and margins remain the physical PDF geometry while the content is reduced to fit its printable width. The requested width must exceed that printable width.
public int MaxOutlinedTextCharactersPerRun { get; set; } #Maximum UTF-16 characters expanded into vector font outlines for one rendered text run. Raise this only for trusted documents with unusually long unbroken text.
public int MaxOutlinedTextPathCommands { get; set; } #Maximum path commands generated by text outlines across one PDF conversion.
public PdfCreateOptions PdfOptions { get; set; } #PDF writer settings used for the generated document, including file version, forward-only serialization, tagging, compliance groundwork, and output intents.
public IOfficeTextShapingProvider? TextShapingProvider { get; set; } #Optional host-provided shaping seam used with caller-supplied or resolved embedded fonts.
public PdfResourcePolicy ResourcePolicy { get; set; } #Host-resource policy. Defaults to library-selected installed fonts and bounded in-source resources; document-selected host fonts, local files and remote reads are disabled.
Inherited Properties
public int PageIndex { get; set; } #public IReadOnlyList<int>? PageSelection { get; set; } #public HtmlRenderMode Mode { get; set; } #public HtmlRenderFidelityPolicy FidelityPolicy { get; set; } #public bool? ProjectSerializedShadowRoots { get; set; } #public double ViewportWidth { get; set; } #public double? ViewportHeight { get; set; } #public OfficePageSize PageSize { get; set; } #public bool HonorCssPageRules { get; set; } #public HtmlRenderMargins Margins { get; set; } #public string DefaultFontFamily { get; set; } #public bool AllowSystemFontFallback { get; set; } #public double DefaultFontSize { get; set; } #public double DefaultLineHeight { get; set; } #public HtmlRenderUserAgentStyleMode UserAgentStyles { get; set; } #public OfficeTextHyphenationCallback? TextHyphenationCallback { get; set; } #public HtmlRenderMediaFeatures MediaFeatures { get; set; } #public IList<string> AdditionalStylesheets { get; } #public Uri? BaseUri { get; set; } #public HtmlUrlPolicy UrlPolicy { get; set; } #public HtmlUrlPolicy? ResourceUrlPolicy { get; set; } #public HtmlRenderResourceResolver? ResourceResolver { get; set; } #public TimeSpan ResourceTimeout { get; set; } #public int MaxConcurrentResourceLoads { get; set; } #public long MaxResourceBytes { get; set; } #public long MaxTotalResourceBytes { get; set; } #public int MaxResourceCount { get; set; } #public int MaxResourceRequests { get; set; } #public int MaxStylesheetImportDepth { get; set; } #public int MaxSurfaceWidth { get; set; } #public int MaxSurfaceHeight { get; set; } #public int MaxPageCount { get; set; } #public int MaxProjectedVisuals { get; set; } #public int MaxLayoutDepth { get; set; } #public int MaxInputCharacters { get; set; } #public int MaxHtmlNodes { get; set; } #public int MaxBackgroundImageTiles { get; set; } #public int MaxBackgroundImageLayers { get; set; } #public int MaxBoxShadowLayers { get; set; } #public int MaxTextShadowLayers { get; set; } #public int MaxLeaderCharacters { get; set; } #public int MaxSvgForeignObjectDepth { get; set; } #public int MaxSvgForeignObjectHtmlNodes { get; set; } #public int MaxFrameDepth { get; set; } #public int MaxGradientStops { get; set; } #public int ConicGradientQualitySegments { get; set; } #public int MaxGridTracks { get; set; } #public int MaxColumnCount { get; set; } #public int MaxTableRows { get; set; } #public int MaxTableColumns { get; set; } #public int MaxCollapsedTableBorderSegments { get; set; } #public int MaxLayoutOperations { get; set; } #public int MaxRunningStringCharacters { get; set; } #public HtmlCssMediaContext MediaContext { get; } #public double PageWidth { get; } #public double PageHeight { get; } #public OfficeImageExportFormat Format { get; set; } #public OfficeImageExportFileConflictPolicy FileConflictPolicy { get; set; } #public bool FailOnLoss { get; set; } #public double Scale { get; set; } #public int? MaximumOutputWidth { get; set; } #public int? MaximumOutputHeight { get; set; } #public OfficeColor BackgroundColor { get; set; } #public OfficeRasterEncodingOptions RasterEncoding { get; set; } #public bool SvgTextAsPaths { get; set; } #public long MaximumRasterPixels { get; set; } #public OfficeRasterOverflowBehavior RasterOverflowBehavior { get; set; } #public IOfficeRasterImageCodec? ImageCodec { get; set; } #public double? TargetDpi { get; set; } #public OfficeFontFaceCollection Fonts { get; set; } #public string? TextShapingLanguage { get; set; } #public OfficeImageExportPolicy Policy { get; set; } #public IProgress<OfficeImageExportProgress>? Progress { get; set; } #public int MaximumOutputCount { get; set; } #public long MaximumTotalRasterPixels { get; set; } #public long MaximumTotalEncodedBytes { get; set; } #public TimeSpan RenderTimeout { get; set; } #public int MaximumDegreeOfParallelism { get; set; } #public virtual double LogicalUnitsPerInch { get; } #