How to convert EMF into PDF in .NET applications using Bytescout.PDF library for .NET

Converting EMF into PDF document

This example demonstrates how to convert EMF into PDF using Bytescout.PDF library

IMPORTANT: for more advanced EMF to PDF conversion support (including enhanced support for EMF produced by virtual printers etc) please see PDFDoc Scout ActiveX library instead. Registered users of Bytescout.PDF can get 50% off for PDFDoc Scout ActiveX

metafile converted into PDF using Bytescout.PDF for .NET

Download example source code: bytescoutpdf_metafile_emf_to_pdf.zip (10 KB)

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Bytescout.PDF;
using System.Drawing.Imaging;


namespace MetafileSample
{
class Program
{
static void Main(string[] args)
{
// Create main PDF Doc Engine
PDFDocEngine engine = new PDFDocEngine("demo", "demo");

// Add new document
Document document = engine.AddDocument();

// create and load metafile
Metafile mf = new Metafile("SampleMetafile.emf");

// Append new page to the document
Page page = document.AddPage(PageSizeType.A3, PageOrientationType.LandScape);

// Create new drawing
Drawing drawing = page.AddDrawing();

// Show images
drawing.PlayMetaFile(mf.GetHenhmetafile(), 0, 0, 1, 1);

// Closing drawing on the page
drawing.Close();

// Save document
document.Save("Metafile.pdf");

// open generated PDF document in default PDF viewer installed in Windows
Process.Start("Metafile.pdf");
}
}
}

Download example source code: bytescoutpdf_metafile_emf_to_pdf.zip (10 KB)

Filed in: PDF SDK for .NET

Tutorials: