RenderPageToMetafileStream

Rendering and printing

Description

This function is only available in the Delphi edition. It renders a page from the selected document into a TStream as a Windows metafile (vector output), preserving the page's text and vector content rather than rasterizing it to pixels.

The chosen Format controls the metafile variant: mfEMF uses the classic GDI enhanced-metafile path (broad consumer compatibility), mfEMFPlus and mfEMFDual use the GDI+ recording path (better fidelity for transparency and anti-aliasing), and mfWMF produces the legacy 16-bit format.

mfEMFDual registrerar både GDI- och GDI+-kommandon i samma fil så att äldre konsumenter som endast stöder GDI fortfarande kan läsa den på bekostnad av en större filstorlek; Föredra mfEMFPlus när du vet att mottagaren stöder GDI+ (Office, Illustrator, moderna visare)

Internally this is a convenience wrapper over RenderPageToStream that maps the Format to an integer Options value, so DPI is still multiplied by the per-instance RenderScale set via SetRenderScale.

Syntax

Delphi

Function TPDFlib.RenderPageToMetafileStream(DPI: Double; Page: Integer; Format: TPDFlibMetafileFormat; Target: TStream): Integer;

Parameters

DPIThe DPI to use when rendering the page. Controls the metafile frame dimensions; vector content itself is DPI-independent
PageThe page number to render
FormatmfEMF = klassisk GDI EMF; mfEMFPlus = endast GDI+ EMF+; mfEMFDual = GDI+ EMF+ Dual (GDI + GDI+-poster, större men allmänt kompatibel); mfWMF = äldre 16-bitars WMF
TargetThe stream to place the rendered metafile bytes into

Return values

0The page could not be rendered
1The page was rendered correctly and the metafile bytes were written to the stream