Class PdfMetafileLayoutFormat
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfMetafileLayoutFormat : PdfLayoutFormat
Examples
// Create a PDF Document.
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create the layout format
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
//Split text and image between pages
format.SplitImages = true;
format.SplitTextLines = true;
//Create a Metafile instance
PdfMetafile metaChart = new PdfMetafile("MetaChart.emf");
//Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format);
//Dispose the metafile.
metaChart.Dispose();
//Save the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
' Create a PDF Document.
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create the layout format
Dim format As New PdfMetafileLayoutFormat()
'Split text and image between pages
format.SplitImages = True
format.SplitTextLines = True
'Create a Metafile instance
Dim metaChart As New PdfMetafile("MetaChart.emf")
'Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format)
'Dispose the metafile.
metaChart.Dispose()
'Save the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)
Constructors
PdfMetafileLayoutFormat()
Declaration
public PdfMetafileLayoutFormat()
Properties
IsHTMLPageBreak
Gets or set the HTML page break.
Declaration
public bool IsHTMLPageBreak { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Examples
//Create new PDF document
PdfDocument doc = new PdfDocument();
//Add a new page
page = doc.Pages.Add();
//Set the dimension of the PDF page
float width = new PdfUnitConvertor().ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point);
float height = -1f;
//Initialize HTML to PDF converter
using (Syncfusion.HtmlConverter.HtmlConverter html = new Syncfusion.HtmlConverter.HtmlConverter())
{
//Convert the URL
HtmlToPdfResult result = html.Convert("http://www.syncfusion.com", ImageType.Metafile, (int)width, (int)height, AspectRatio.KeepWidth);
if (result != null)
{
//Get the HTML as PdfMetafile
PdfMetafile mf = new PdfMetafile(result.RenderedImage as Metafile);
//Formatting options
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitPage;
format.Layout = PdfLayoutType.Paginate;
doc.PageSettings.Height = result.RenderedImage.Size.Height;
format.SplitTextLines = false;
format.SplitImages = false;
format.IsHTMLPageBreak = true;
//Render the PdfMetafile in the PDF document
result.Render(page, format);
}
}
//Save the PDF
doc.Save(@"Output.pdf");
//Close the PDF
doc.Close(true);
'Create new PDF document
Dim doc As New PdfDocument()
'Add a new page
page = doc.Pages.Add()
'Set the dimension of the PDF page
Dim width As Single = New PdfUnitConvertor().ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point)
Dim height As Single = -1F
'Initialize HTML to PDF converter
Using html As New Syncfusion.HtmlConverter.HtmlConverter()
'Convert the URL
Dim result As HtmlToPdfResult = html.Convert("http://www.syncfusion.com", ImageType.Metafile, CInt(width), CInt(height), AspectRatio.KeepWidth)
If result IsNot Nothing Then
'Get the HTML as PdfMetafile
Dim mf As New PdfMetafile(TryCast(result.RenderedImage, Metafile))
'Formatting options
Dim format As New PdfMetafileLayoutFormat()
format.Break = PdfLayoutBreakType.FitPage
format.Layout = PdfLayoutType.Paginate
doc.PageSettings.Height = result.RenderedImage.Size.Height
format.SplitTextLines = False
format.SplitImages = False
format.IsHTMLPageBreak = True
'Render the PdfMetafile in the PDF document
result.Render(page, format)
End If
End Using
'Save the PDF
doc.Save("Output.pdf")
'Close the PDF
doc.Close(True)
SplitImages
Gets or sets a value indicating whether [split images].
Declaration
public bool SplitImages { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
// Create a PDF Document.
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create the layout format
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
//Split text and image between pages
format.SplitImages = true;
format.SplitTextLines = true;
//Create a Metafile instance
PdfMetafile metaChart = new PdfMetafile("MetaChart.emf");
//Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format);
//Dispose the metafile.
metaChart.Dispose();
//Save the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
' Create a PDF Document.
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create the layout format
Dim format As New PdfMetafileLayoutFormat()
'Split text and image between pages
format.SplitImages = True
format.SplitTextLines = True
'Create a Metafile instance
Dim metaChart As New PdfMetafile("MetaChart.emf")
'Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format)
'Dispose the metafile.
metaChart.Dispose()
'Save the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)
SplitTextLines
Gets or sets a value indicating whether [split text lines].
Declaration
public bool SplitTextLines { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
// Create a PDF Document.
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create the layout format
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
//Split text and image between pages
format.SplitImages = true;
format.SplitTextLines = true;
//Create a Metafile instance
PdfMetafile metaChart = new PdfMetafile("MetaChart.emf");
//Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format);
//Dispose the metafile.
metaChart.Dispose();
//Save the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
' Create a PDF Document.
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create the layout format
Dim format As New PdfMetafileLayoutFormat()
'Split text and image between pages
format.SplitImages = True
format.SplitTextLines = True
'Create a Metafile instance
Dim metaChart As New PdfMetafile("MetaChart.emf")
'Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format)
'Dispose the metafile.
metaChart.Dispose()
'Save the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)
UseImageResolution
Gets or sets a value indicating whether to use the orginal Horizontal and Vertical resolution of the metafile.
Declaration
public bool UseImageResolution { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
// Create a PDF Document.
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create the layout format
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
//Uses the orginal Horizontal and Vertical resolution of the metafile
format.UseImageResolution = true;
//Create a Metafile instance
PdfMetafile metaChart = new PdfMetafile("MetaChart.emf");
//Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format);
//Dispose the metafile.
metaChart.Dispose();
//Save the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
' Create a PDF Document.
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create the layout format
Dim format As New PdfMetafileLayoutFormat()
'Uses the orginal Horizontal and Vertical resolution of the metafile
format.UseImageResolution = True
'Create a Metafile instance
Dim metaChart As New PdfMetafile("MetaChart.emf")
'Draw the Metafile in the page
metaChart.Draw(page, PointF.Empty, format)
'Dispose the metafile.
metaChart.Dispose()
'Save the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)