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

40 views
Skip to first unread message

Support

unread,
Aug 21, 2013, 4:53:39 PM8/21/13
to pdfne...@googlegroups.com
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

 

 

 

 

 

 

 

 

 

 

 

 

Support

unread,
Mar 24, 2015, 1:33:56 AM3/24/15
to pdfne...@googlegroups.com

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
Reply all
Reply to author
Forward
0 new messages