- C# Print document | Code Sample | Tall Components PDF C# samples
- Change colors of black-and-white TIFF after converting from PDF
- Convert multiple PDF pages to bitmap
- Convert PDF to an image using a dither matrix
- Convert PDF to JPG in C#
- Convert PDF to multipage TIFF in C# .NET
- Convert PDF to PNG using WPF
- Convert PDF to XPS
- Convert PDF with layers to image
- Display PDF in a WPF app and stay responsive - the code
- Font mapping
- PDF to grayscale TIFF C#
- C# Print PDF documents from a WPF application
- Render a PDF to bitmap
- Render PDF with ResolveFont event handler
- Render PDF to EMF
- Use multiple licenses
- How to use a system font for rendering text
Render PDF to EMF
This code sample helps render PDF to EMF. PDF Rasterizer can also render a PDF page to to an EMF object (Enhanced Metafile). This format is graphical format which is commonly used in .NET applications and in printing.
using (FileStream fs = new FileStream(@"..\..\input.pdf", FileMode.Open, FileAccess.Read))
{
Document d = new Document(fs);
Page page = d.Pages[0];
Metafile metafile = null;
using (Graphics graphics = this.CreateGraphics())
{
System.IntPtr hdc = graphics.GetHdc();
metafile = new Metafile(hdc, new System.Drawing.RectangleF(0, 0, (float)page.Width, (float)page.Height), MetafileFrameUnit.Point);
graphics.ReleaseHdc(hdc);
}
using (Graphics metafileGraphics = Graphics.FromImage(metafile))
{
metafileGraphics.SmoothingMode = SmoothingMode.AntiAlias;
page.Draw(metafileGraphics);
}
}