Saves the document options to an XML file on disk.
public void SaveOptions(string fileName)
Public Overloads Sub SaveOptions( _ByVal fileName As String _)
macOS Only:- (BOOL)saveOptionsToFile:(NSString *)fileName error:(NSError **)error
public void saveOptions(String fileName)public:void SaveOptions(String^ fileName)
fileName
The name of XML file to save the options to.
To load the options saved into a disk file by the SaveOptions(string) method, use LoadOptions(string).
To load and save the options to an XML stream instead of a file, use LoadOptions(Stream) and SaveOptions(Stream).
Saving the options to an XML file allows the options to be set the required way once and then re-used in multiple sessions (or multiple DocumentWriter instances). Each document format supported by the LEADTOOLS Document Writer contain extra functionality and options that can be accessed with the GetOptions and SetOptions methods. For more information, refer to DocumentOptions.
The following options are saved to the XML:
The following options are saved to the XML:
This example will change some of the options in a DocumentWriter object, saves them to disk and then re-load them in a new instance.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.Forms.DocumentWritersImports Leadtools.Forms.OcrPublic Sub DocumentOptionsDiskExample()Dim xmlFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "DocumentWriterOptions.xml")' Create a new instance of the LEADTOOLS Document WriterDim docWriter1 As New DocumentWriter()' Show the default PDF and HTML options beforeShowOptions("Default options for docWriter1", docWriter1)' Change the PDF options and HTML optionsDim pdfOptions As PdfDocumentOptions = DirectCast(docWriter1.GetOptions(DocumentFormat.Pdf), PdfDocumentOptions)pdfOptions.DocumentType = PdfDocumentType.PdfApdfOptions.ImageOverText = TruedocWriter1.SetOptions(DocumentFormat.Pdf, pdfOptions)Dim htmlOptions As HtmlDocumentOptions = DirectCast(docWriter1.GetOptions(DocumentFormat.Html), HtmlDocumentOptions)htmlOptions.DocumentType = HtmlDocumentType.IENetscapehtmlOptions.UseBackgroundColor = TruehtmlOptions.BackgroundColor = RasterColor.FromKnownColor(RasterKnownColor.LightBlue)docWriter1.SetOptions(DocumentFormat.Html, htmlOptions)' Show the options againShowOptions("New options for docWriter1", docWriter1)' Save these options to diskdocWriter1.SaveOptions(xmlFileName)' Create a new DocumentWriter objectDim docWriter2 As New DocumentWriter()' Show its options, should be the defaultsShowOptions("Default options for docWriter2", docWriter2)' Load the options from disk to this objectdocWriter2.LoadOptions(xmlFileName)' Show the options now, should be the saved onesShowOptions("Options for docWriter2 after loading from the XML file", docWriter2)End SubPrivate Sub ShowOptions(message As String, docWriter As DocumentWriter)Console.WriteLine(message)Dim pdfOptions As PdfDocumentOptions = DirectCast(docWriter.GetOptions(DocumentFormat.Pdf), PdfDocumentOptions)Console.WriteLine(" PDF options: ")Console.WriteLine(" DocumentType: " + pdfOptions.DocumentType.ToString())Console.WriteLine(" FontEmbedMode: " + pdfOptions.FontEmbedMode.ToString())Console.WriteLine(" ImageOverText: " + pdfOptions.ImageOverText.ToString())Dim htmlOptions As HtmlDocumentOptions = DirectCast(docWriter.GetOptions(DocumentFormat.Html), HtmlDocumentOptions)Console.WriteLine(" HTML options: ")Console.WriteLine(" DocumentType: " + htmlOptions.DocumentType.ToString())Console.WriteLine(" FontEmbedMode: " + htmlOptions.FontEmbedMode.ToString())Console.WriteLine(" UseBackgroundColor: " + htmlOptions.UseBackgroundColor.ToString())Console.WriteLine(" BackgroundColor: " + htmlOptions.BackgroundColor.ToString())Console.WriteLine("-------------------------")End Sub
using Leadtools;using Leadtools.Codecs;using Leadtools.Forms.DocumentWriters;using Leadtools.Forms.Ocr;public void DocumentOptionsDiskExample(){var xmlFileName = Path.Combine(LEAD_VARS.ImagesDir, "DocumentWriterOptions.xml");// Create a new instance of the LEADTOOLS Document Writervar docWriter1 = new DocumentWriter();// Show the default PDF and HTML options beforeShowOptions("Default options for docWriter1", docWriter1);// Change the PDF options and HTML optionsvar pdfOptions = docWriter1.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions;pdfOptions.DocumentType = PdfDocumentType.PdfA;pdfOptions.ImageOverText = true;docWriter1.SetOptions(DocumentFormat.Pdf, pdfOptions);var htmlOptions = docWriter1.GetOptions(DocumentFormat.Html) as HtmlDocumentOptions;htmlOptions.DocumentType = HtmlDocumentType.IENetscape;htmlOptions.UseBackgroundColor = true;htmlOptions.BackgroundColor = RasterColor.FromKnownColor(RasterKnownColor.LightBlue);docWriter1.SetOptions(DocumentFormat.Html, htmlOptions);// Show the options againShowOptions("New options for docWriter1", docWriter1);// Save these options to diskdocWriter1.SaveOptions(xmlFileName);// Create a new DocumentWriter objectvar docWriter2 = new DocumentWriter();// Show its options, should be the defaultsShowOptions("Default options for docWriter2", docWriter2);// Load the options from disk to this objectdocWriter2.LoadOptions(xmlFileName);// Show the options now, should be the saved onesShowOptions("Options for docWriter2 after loading from the XML file", docWriter2);}private void ShowOptions(string message, DocumentWriter docWriter){Console.WriteLine(message);var pdfOptions = docWriter.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions;Console.WriteLine(" PDF options: ");Console.WriteLine(" DocumentType: " + pdfOptions.DocumentType);Console.WriteLine(" FontEmbedMode: " + pdfOptions.FontEmbedMode);Console.WriteLine(" ImageOverText: " + pdfOptions.ImageOverText);var htmlOptions = docWriter.GetOptions(DocumentFormat.Html) as HtmlDocumentOptions;Console.WriteLine(" HTML options: ");Console.WriteLine(" DocumentType: " + htmlOptions.DocumentType);Console.WriteLine(" FontEmbedMode: " + htmlOptions.FontEmbedMode);Console.WriteLine(" UseBackgroundColor: " + htmlOptions.UseBackgroundColor);Console.WriteLine(" BackgroundColor: " + htmlOptions.BackgroundColor);Console.WriteLine("-------------------------");}
Programming with LEADTOOLS Document Writers
|
Products |
Support |
Feedback: SaveOptions(String) Method - Leadtools.Forms.DocumentWriters |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.