I'm working with the console application provided by Walter linked from the white paper
 Extend Existing Applications with the LEADTOOLS Virtual Printer SDK.  It creates 3 image formats - a .emf, a .pdf, and a .png.  I need a tiff file as well so I copied the method for .png and made what I thought were necessary changes, but it ends with an error at the line metaFile = new Metafile(e.Stream) below in blue 
{System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
   at System.Drawing.Imaging.Metafile..ctor(Stream stream)
   at Virtual_Printer_Driver_Sample.EmfEventMethods.FillSection_Tif(Object sender, EmfEventArgs e) in c:\Users\bwilliams\Desktop\LeadTools Eval License\Virtual Printer Driver Console\Virtual Printer Driver Sample\EmfEventMethods.cs:line 130} 
Here is the method.  what do I need to do to get the code working?
        [EmfEventMethodAttribute]
        public static void FillSection_Tif(object sender, Leadtools.Printer.EmfEventArgs e)
        {
            ConsoleMethods.Info("EMF Event: FillSection_Tif");
            const string format = "tif";
            string path = Path.Combine(
               GetOutputRootPath(),
               format + @"\",
               GetRandomFileName(format));
            Directory.CreateDirectory(Path.GetDirectoryName(path));
            // Get the EMF in memory and save as TIF.
            Metafile metaFile = null;
            try
            {                
metaFile = new Metafile(e.Stream);
                IntPtr hEmf = metaFile.GetHenhmetafile();
                using (RasterImage image = RasterImageConverter.FromEmf(hEmf, 0, 0, RasterColor.White))
                {
                    using (RasterRegion region = new RasterRegion(new LeadRect(20, 30, 100, 200)))
                    {
                        image.SetRegion(null, region, RasterRegionCombineMode.Set);
                        new FillCommand(RasterColor.FromKnownColor(RasterKnownColor.Black)).Run(image);
                    }
                    using (RasterCodecs codecs = new RasterCodecs())
                    {
                        codecs.Save(image, path, RasterImageFormat.Tif, 1);
                    }
                }
                ConsoleMethods.Success("FillSection_Png: TIF saved. ");
                ConsoleMethods.Verbose(path);
            }
            catch (Exception ex)
            {
                ConsoleMethods.Error(ex.Message, 4000);
            }
        }
    }
Edited by moderator Friday, October 7, 2016 4:37:21 PM(UTC)
 | Reason: added link to whitepaper