←Select platform

EmfDocumentOptions Class

Summary
Provides extra options to use when saving a document using the Windows Enhanced Meta File (EMF) format.
Syntax
C#
VB
C++
Java
[SerializableAttribute()][DataContractAttribute()]publicclassEmfDocumentOptions :DocumentOptions
PublicClassEmfDocumentOptionsInheritsDocumentOptions
publicclassEmfDocumentOptionsextendsDocumentOptions
[DataContractAttribute()][SerializableAttribute()]publicref classEmfDocumentOptions :publicDocumentOptions
Remarks

The Windows Enhanced Meta File (EMF) format does not support multipage documents. Therefore, only the last page added with theDocumentWriter.AddPagewill be used in the final document.

Note that this format does not support callingDocumentWriter.InsertPage.

The options set in theEmfDocumentOptionsclass will be used when the user saves a document using theDocumentFormat.Emfformat.

To change the options used with the EMF format, perform the following steps:

  1. Use theDocumentWriter.GetOptionsmethod of theDocumentWriterobject being used. PassDocumentFormat.Emfto theformatparameter. Note that the resulting object from the baseDocumentOptionsclass needs to be cast toEmfDocumentOptions.
  2. Use the variousEmfDocumentOptions属性改变options.
  3. UseDocumentWriter.SetOptionsto set the new options in the engine.
  4. Now you can call theDocumentWriter.BeginDocumentmethod (withDocumentFormat.Emffor theformatparameter) to create a new document and add the pages.

Note that this format does not support callingDocumentWriter.InsertPage.

Currently, theEmfDocumentOptionsclass contains no extra options.

Example

This example will create a new Windows Enhanced Meta File (EMF) file using the various supported options.

C#
VB
usingLeadtools.Document.Writer;usingLeadtools;usingLeadtools.Codecs;public无效EmfDocumentOptionsExample(){varinputFileName = Path.Combine(LEAD_VARS.ImagesDir,"Leadtools.pdf");varoutputFileNameTemplate = Path.Combine(LEAD_VARS.ImagesDir,"Example{0}.emf");// Setup a new RasterCodecs objectvarcodecs =newRasterCodecs();codecs.Options.RasterizeDocument.Load.Resolution = 300;// Get the number of pages in the input documentvarpageCount = codecs.GetTotalPages(inputFileName);// Create a new instance of the LEADTOOLS Document WritervardocWriter =newDocumentWriter();// Change the EMF optionsvaremfOptions = docWriter.GetOptions(DocumentFormat.Emf)asEmfDocumentOptions;// EMF currently does not have any extra options// In the future, you can modify the options here if neededdocWriter.SetOptions(DocumentFormat.Emf, emfOptions);// EMF does not support multiple pages, so we will create the document inside the loop// Loop through all the pagesfor(varpageNumber = 1; pageNumber <= pageCount; pageNumber++){varoutputFileName =string.Format(outputFileNameTemplate, pageNumber);// Create a new EMF documentConsole.WriteLine("Creating new EMF document : {0}", outputFileName);docWriter.BeginDocument(outputFileName, DocumentFormat.Emf);// Get the page as SVGConsole.WriteLine("Loading page {0}", pageNumber);varpage =newDocumentWriterSvgPage();page.SvgDocument = codecs.LoadSvg(inputFileName, pageNumber,null);// Add the pageConsole.WriteLine("Adding page {0}", pageNumber);docWriter.AddPage(page);page.SvgDocument.Dispose();// Finish writing theis EMF file on diskdocWriter.EndDocument();}codecs.Dispose();}staticclassLEAD_VARS{publicconststringImagesDir =@"C:\LEADTOOLS21\Resources\Images";}
ImportsLeadtools.Document.WriterImportsLeadtoolsImportsLeadtools.CodecsPublicSubEmfDocumentOptionsExample()DiminputFileNameAsString= Path.Combine(LEAD_VARS.ImagesDir,"Leadtools.pdf")DimoutputFileNameTemplateAsString= Path.Combine(LEAD_VARS.ImagesDir,"Example{0}.emf")' Setup a new RasterCodecs objectDimcodecsAsNewRasterCodecs()codecs.Options.RasterizeDocument.Load.Resolution = 300' Get the number of pages in the input documentDimpageCountAsInteger= codecs.GetTotalPages(inputFileName)' Create a new instance of the LEADTOOLS Document WriterDimdocWriterAsNewDocumentWriter()' Change the EMF optionsDimemfOptionsAsEmfDocumentOptions =DirectCast(docWriter.GetOptions(DocumentFormat.Emf), EmfDocumentOptions)' EMF currently does not have any extra options' In the future, you can modify the options here if neededdocWriter.SetOptions(DocumentFormat.Emf, emfOptions)' EMF does not support multiple pages, so we will create the document inside the loop' Loop through all the pagesForpageNumberAsInteger= 1TopageCountDimoutputFileNameAsString=String.Format(outputFileNameTemplate, pageNumber)' Create a new EMF documentConsole.WriteLine("Creating new EMF document : {0}", outputFileName)docWriter.BeginDocument(outputFileName, DocumentFormat.Emf)' Get the page as SVGConsole.WriteLine("Loading page {0}", pageNumber)DimpageAsNewDocumentWriterSvgPage()page.SvgDocument = codecs.LoadSvg(inputFileName, pageNumber,Nothing)' Add the pageConsole.WriteLine("Adding page {0}", pageNumber)docWriter.AddPage(page)page.SvgDocument.Dispose()' Finish writing theis EMF file on diskdocWriter.EndDocument()Nextcodecs.Dispose()EndSubPublicNotInheritableClassLEAD_VARSPublicConstImagesDirAsString="C:\LEADTOOLS21\Resources\Images"EndClass
Requirements

Target Platforms

Leadtools.Document.Writer Assembly
188金宝搏的网址客服|Support|Contact Us|Intellectual Property Notices
© 1991-2021LEAD Technologies, Inc.All Rights Reserved.