PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.
- How to use a system font for rendering text
- PDF to grayscale TIFF
- Display PDF in a WPF app and stay responsive - the code
- C# Print PDF documents from a WPF application
- Change colors of black-and-white TIFF after converting from PDF
- Convert PDF to PNG using WPF
- Convert PDF to an image using a dither matrix
- Font mapping
- Convert PDF with layers to image
- C# Print PDF Document
- Render PDF with ResolveFont event handler
- Render PDF to EMF
- Convert PDF to XPS
- Convert PDF to JPG in C#
- Convert PDF to multipage TIFF in C# .NET
- Convert multiple PDF pages to bitmap
- Render a PDF to bitmap
- Use multiple licenses
Render PDF with ResolveFont event handler
When you try to render a PDF which uses non-system fonts, you can add your own specified fonts to make sure it is rendered correctly.
static void Main(string[] args)
{
using (FileStream fs = new FileStream("input.pdf",FileMode.Open,FileAccess.Read))
{
Document d = new Document(fs);
Page page = d.Pages[0];
RenderSettings renderSettings = new RenderSettings();
renderSettings.TextSettings.ResolveFont += new ResolveFontEventHandler(Resolve);
Bitmap bmp = new Bitmap((int)page.Width * 4, (int)page.Height * 4);
using (Graphics graphics = Graphics.FromImage(bmp))
{
graphics.ScaleTransform(4.0f, 4.0f);
page.Draw(graphics, renderSettings);
}
}
}
// map all non-system fonts to arial
static void Resolve(TextRenderSettings sender, ResolveFontEventArgs args)
{
if (args.FontLocation != FontLocation.System)
{
args.FontRenderMode = FontRenderMode.RenderAsFont;
if (args.PdfFontName.EndsWith("Bold"))
{
args.Bold = true;
}
args.SystemFontName = "Arial";
}
}
Download PDFRasterizer.NET 3.0
We will send you a download link
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download
We have sent an email with a download link.