示例#1
0
        private static void Printer_EmfEvent(object sender, EmfEventArgs e)
        {
            string licString    = @"F:\LeadToolsDeveloperTrialVersion\eval-license-files_ca9205db-0588-4317-8b13-dc1fef29e86e\eval-license-files.lic";
            string developerKey = "g8xOXslT1JadbVXDQNE7k4CRUMBLLjEIvt383qJptzPvoMXYamOe13OYknr9CmFEbpzAcriaPCSEpO9G9+HPl0sjQaEqn0zu";

            RasterSupport.SetLicense(licString, developerKey);
            System.IO.File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, @"LEADTOOLS_IMAGE1.emf"), e.Stream.ToArray());
            Metafile metaFile = new Metafile(e.Stream);

            Image emfImage = metaFile.GetThumbnailImage(metaFile.Width, metaFile.Height, null, IntPtr.Zero);

            emfImage.Save(Path.Combine(LEAD_VARS.ImagesDir, @"LEADTOOLS_IMAGE2.emf"));
        }
示例#2
0
        public void _printer_EmfEvent(object sender, EmfEventArgs e)
        {
            if (_jobHolder == null)
            {
                return;
            }

            string tempFile = Path.GetTempFileName();

            File.WriteAllBytes(tempFile, e.Stream.ToArray());

            SetProgressState();

            _jobHolder.AddEmf(tempFile);
        }
示例#3
0
        static void VirtualPrinter_EmfEvent(object sender, EmfEventArgs e)
        {
            string pdfPath = Path.Combine(@"F:\Output\",
                                          Path.GetFileNameWithoutExtension(Path.GetRandomFileName())
                                          ) + ".pdf";

            Directory.CreateDirectory(Path.GetDirectoryName(pdfPath));

            // Create an instance of the LEADTOOLS DocumentWriter
            Leadtools.Document.Writer.DocumentWriter docWriter = new DocumentWriter();
            docWriter.BeginDocument(pdfPath, Leadtools.Document.Writer.DocumentFormat.Pdf);

            Leadtools.Document.Writer.DocumentWriterEmfPage page = new DocumentWriterEmfPage()
            {
                EmfHandle = new Metafile(e.Stream).GetHenhmetafile()
            };
            docWriter.AddPage(page);
            docWriter.EndDocument();
        }
示例#4
0
        public void _printer_EmfEvent(object sender, EmfEventArgs e)
        {
            this.Enabled = false;
            string tempFile = Path.GetTempFileName();

            _tempFiles.Add(tempFile);
            File.WriteAllBytes(tempFile, e.Stream.ToArray());

            Metafile metaFile = new Metafile(e.Stream);

            _pageNo++;

            if (_frmProgress.Visible)
            {
                _frmProgress.SetProgressState(_pageNo, _jobId);
            }

            Image emfImage   = metaFile.GetThumbnailImage(_lstBoxPages.Width, _lstBoxPages.ItemHeight, null, IntPtr.Zero);
            int   nLastIndex = _lstBoxPages.Items.Add(emfImage);

            _lstMetaFiles.Add(metaFile.GetHenhmetafile());
            _lstJobInfo.Add(new JobInfoStruct(_jobId, _pageNo));
        }
示例#5
0
 void printer_EmfEvent(object sender, EmfEventArgs e)
 {
 }
示例#6
0
        static void VirtualPrinter_EmfEvent( object sender, EmfEventArgs e )
        {
            // Using reflection for demo purposes.
             // Program.cs does not need to change.  Implementation is only in EmfEventMethods.cs.
             // However, any method in assembly that is decorated with EmfEventMethodAttribute
             // and has signature of void f( object, EmfEventArgs ) will be called.
             MethodInfo[] emfEventMethods =
            Assembly.GetExecutingAssembly()
                    .GetTypes()
                    .SelectMany( t => t.GetMethods() )
                    .Where( m => m.GetCustomAttributes( typeof( EmfEventMethodAttribute ), false )
                                  .Length > 0 )
                    .Where( p => p.GetParameters()
                                  .Select( s => s.ParameterType )
                                  .SequenceEqual( new Type[] { typeof( object ), typeof( EmfEventArgs ) } )
                              && p.ReturnType == typeof( void ) )
                    .ToArray();

             foreach ( MethodInfo emfEventMethod in emfEventMethods )
             {
            emfEventMethod.Invoke( null, new[] { sender, e } );
             }
        }