Does PDFNet support conversion of windows WMF or EMF metafile to PDF?

Q: Does the PDFNet SDK currently support conversion of windows .wmf or .emf metafile data to PDF?

A:

PDFNet includes PDFDC and PDFDCEx classes (on Windows) that can be used to convert EMF or GDI commands to PDF: http://www.pdftron.com/pdfnet/samplecode.html#PDFDC

You can also to convert EMF/WMF directly using pdftron.PDF.Convert.ToPdf(“my.emf”) as shown in Convert sample project: http://www.pdftron.com/pdfnet/samplecode.html#Convert

Another way to convert Windows Metafile to PDF is using PDFDCEX. This approach has a few advantages (like better conversion etc) over PDFDC/FromEMF():

PDFNet.Initialize();

using (PDFDCEX pdfdcex = new PDFDCEX())

using (PDFDoc pdfdoc = new PDFDoc()) {
string emf_file_path = input_path + “simple-emf.emf”;
pdfdcex.Begin(pdfdoc);
using(Graphics gr = pdfdcex.StartPage()) {
using(Metafile img = new Metafile(emf_file_path)) {
gr.DrawImage(img, 0, 0);
}
pdfdcex.EndPage();
}
pdfdcex.End();
pdfdoc.Save(output_path + “mem_test.pdf”, SDFDoc.SaveOptions.e_linearized);

Full sample code is attached

PDFDCTest.cs (2.19 KB)