- 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
Convert PDF with layers to image
In the code sample below you see how you can incorporate multiple layers into your rendering process. Simply set the Visibility of the layers which you want to render to true, and add the LayerCollection to your RenderSettings object.
using (FileStream fs = new FileStream(@"..\..\input.pdf", FileMode.Open, FileAccess.Read))
{
Document d = new Document(fs);
LayerCollection layers = d.Layers;
//select layers to render
layers[0].Visible = true;
layers[1].Visible = false;
Page page = d.Pages[0];
Bitmap bitmap = new Bitmap((int)page.Width, (int)page.Height);
using (Graphics graphics = Graphics.FromImage(bitmap))
{
RenderSettings renderSettings = new RenderSettings();
renderSettings.LayerSettings.Layers = layers;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
page.Draw(graphics, renderSettings);
}
bitmap.Save(@"..\..\output.bmp");
}