SizeMode Property

Summary
Gets or sets a value that indicate the transformation to use when converting the logical size specified in PageWidth and PageHeight to the final physical raster image size.
Syntax
C#
C++/CLI
public CodecsRasterizeDocumentSizeMode SizeMode { get; set; } 
public: 
property CodecsRasterizeDocumentSizeMode SizeMode { 
   CodecsRasterizeDocumentSizeMode get(); 
   void set (    CodecsRasterizeDocumentSizeMode value); 
} 

Property Value

A Leadtools.Codecs.CodecsRasterizeDocumentSizeMode enumeration member that indicate the transformation to use when converting the logical size specified in PageWidth and PageHeight to the final physical raster image size. Default value is CodecsRasterizeDocumentSizeMode.None.

Remarks

For more information, refer to Leadtools.Codecs.CodecsRasterizeDocumentLoadOptions

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.WinForms.CommonDialogs.File; 
 
 
public void RasterOpenDialogExample() 
{ 
	RasterCodecs rasterCodecs = new RasterCodecs(); 
 
	RasterOpenDialog openDlg = new RasterOpenDialog(rasterCodecs); 
 
	openDlg.Filter = new RasterOpenDialogLoadFormat[] 
	{ 
	new RasterOpenDialogLoadFormat ( "All Files", "*.*" ), 
	new RasterOpenDialogLoadFormat ( "LEAD", "*.cmp" ) 
	}; 
 
	openDlg.CheckFileExists = true; 
	openDlg.CheckPathExists = true; 
	openDlg.DefaultExt = "cmp"; 
	openDlg.DereferenceLinks = true; 
	openDlg.EnableSizing = true; 
	openDlg.FileName = "Image1.cmp"; 
	openDlg.FilterIndex = 2; 
	openDlg.GenerateThumbnail = false; 
	openDlg.InitialDirectory = LEAD_VARS.ImagesDir; 
	openDlg.InitialView = FileDialogInitialView.List; 
	openDlg.LoadCompressed = true; 
	openDlg.LoadFileImage = false; 
	openDlg.LoadOptions = false; 
	openDlg.LoadRotated = false; 
	openDlg.Multiselect = true; 
	openDlg.PreviewWindowVisible = true; 
	openDlg.ShowDeletePage = true; 
	openDlg.ShowFileInformation = true; 
	openDlg.ShowGeneralOptions = true; 
	openDlg.ShowHelp = true; 
	openDlg.ShowLoadCompressed = true; 
	openDlg.ShowLoadOptions = true; 
	openDlg.ShowLoadRotated = true; 
	openDlg.ShowMultipage = true; 
	openDlg.ShowPdfOptions = true; 
	openDlg.ShowXpsOptions = true; 
	openDlg.ShowXlsOptions = true; 
	openDlg.ShowVffOptions = true; 
	openDlg.ShowAnzOptions = true; 
	openDlg.ShowVectorOptions = true; 
	openDlg.ShowPreview = true; 
	openDlg.ShowProgressive = true; 
	openDlg.ShowRasterOptions = true; 
	openDlg.ShowTotalPages = true; 
	openDlg.Title = "Open Dialog"; 
	openDlg.UseFileStamptoPreview = true; 
	openDlg.Help += new EventHandler<RasterDialogHelpEventArgs>(openDlg_Help); 
	openDlg.LoadCorrupted = true; 
 
	// if you set "openDlg.LoadFileImage = true" this event will be fired 
	openDlg.LoadProgress += new EventHandler<RasterDialogLoadProgressEventArgs>(openDlg_LoadProgress); 
 
	if (DialogResult.OK == openDlg.ShowDialog(null)) 
	{ 
		for (int i = 0; i < openDlg.OpenedFileData.Count; i++) 
		{ 
			RasterDialogFileData fileDataItem = openDlg.OpenedFileData[i]; 
 
			// this is not an image file. 
			if (fileDataItem.Options == null) 
			{ 
				continue; 
			} 
 
			rasterCodecs.Options.RasterizeDocument.Load.PageWidth = fileDataItem.Options.RasterizeDocumentOptions.PageWidth; 
			rasterCodecs.Options.RasterizeDocument.Load.PageHeight = fileDataItem.Options.RasterizeDocumentOptions.PageHeight; 
			rasterCodecs.Options.RasterizeDocument.Load.LeftMargin = fileDataItem.Options.RasterizeDocumentOptions.LeftMargin; 
			rasterCodecs.Options.RasterizeDocument.Load.TopMargin = fileDataItem.Options.RasterizeDocumentOptions.TopMargin; 
			rasterCodecs.Options.RasterizeDocument.Load.RightMargin = fileDataItem.Options.RasterizeDocumentOptions.RightMargin; 
			rasterCodecs.Options.RasterizeDocument.Load.BottomMargin = fileDataItem.Options.RasterizeDocumentOptions.BottomMargin; 
			rasterCodecs.Options.RasterizeDocument.Load.Unit = fileDataItem.Options.RasterizeDocumentOptions.Unit; 
			rasterCodecs.Options.RasterizeDocument.Load.XResolution = fileDataItem.Options.RasterizeDocumentOptions.XResolution; 
			rasterCodecs.Options.RasterizeDocument.Load.YResolution = fileDataItem.Options.RasterizeDocumentOptions.YResolution; 
			rasterCodecs.Options.RasterizeDocument.Load.SizeMode = fileDataItem.Options.RasterizeDocumentOptions.SizeMode; 
 
			switch (fileDataItem.Options.FileType) 
			{ 
				case RasterDialogFileOptionsType.Meta: 
					{ 
						if (null != fileDataItem.Options.MetaOptions) 
						{ 
							rasterCodecs.Options.Wmf.Load.XResolution = fileDataItem.Options.MetaOptions.XResolution; 
							rasterCodecs.Options.Wmf.Load.YResolution = fileDataItem.Options.MetaOptions.XResolution; 
						} 
						break; 
					} 
 
				case RasterDialogFileOptionsType.Pdf: 
					{ 
						if ((null != fileDataItem.Options.PdfOptions) && 
							  rasterCodecs.Options.Pdf.IsEngineInstalled) 
						{ 
							rasterCodecs.Options.Pdf.Load.DisplayDepth = fileDataItem.Options.PdfOptions.DisplayDepth; 
							rasterCodecs.Options.Pdf.Load.GraphicsAlpha = fileDataItem.Options.PdfOptions.GraphicsAlpha; 
 
							if (fileDataItem.Options.PdfOptions.Password != null) 
							{ 
								rasterCodecs.Options.Pdf.Load.Password = fileDataItem.Options.PdfOptions.Password; 
							} 
 
							rasterCodecs.Options.Pdf.Load.TextAlpha = fileDataItem.Options.PdfOptions.TextAlpha; 
							rasterCodecs.Options.Pdf.Load.UseLibFonts = fileDataItem.Options.PdfOptions.UseLibFonts; 
						} 
						break; 
					} 
 
				case RasterDialogFileOptionsType.Misc: 
					{ 
						if (null == fileDataItem.Options.MiscOptions) 
						{ 
							continue; 
						} 
 
						switch (fileDataItem.FileInfo.Format) 
						{ 
							case RasterImageFormat.Jbig: 
								{ 
									rasterCodecs.Options.Jbig.Load.Resolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
									   fileDataItem.Options.MiscOptions.YResolution); 
									break; 
								} 
 
							case RasterImageFormat.Cmw: 
								{ 
									rasterCodecs.Options.Jpeg2000.Load.CmwResolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
									   fileDataItem.Options.MiscOptions.YResolution); 
									break; 
								} 
 
							case RasterImageFormat.Jp2: 
								{ 
									rasterCodecs.Options.Jpeg2000.Load.Jp2Resolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
									   fileDataItem.Options.MiscOptions.YResolution); 
									break; 
								} 
 
							case RasterImageFormat.J2k: 
								{ 
									rasterCodecs.Options.Jpeg2000.Load.J2kResolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
									   fileDataItem.Options.MiscOptions.YResolution); 
									break; 
								} 
						} 
						break; 
					} 
 
				case RasterDialogFileOptionsType.Xls: 
					rasterCodecs.Options.Xls.Load.MultiPageSheet = fileDataItem.Options.XlsOptions.MultiPageSheet; 
					rasterCodecs.Options.Xls.Load.MultiPageEnableMargins = fileDataItem.Options.XlsOptions.MultiPageEnableMargins; 
					rasterCodecs.Options.Xls.Load.MultiPageUseSheetWidth = fileDataItem.Options.XlsOptions.MultiPageUseSheetWidth; 
					rasterCodecs.Options.Xls.Load.PageOrderDownThenOver = fileDataItem.Options.XlsOptions.PageOrderDownThenOver; 
					break; 
 
				case RasterDialogFileOptionsType.Vff: 
					rasterCodecs.Options.Vff.Load.View = fileDataItem.Options.VffOptions.View; 
					break; 
 
				case RasterDialogFileOptionsType.Anz: 
					rasterCodecs.Options.Anz.Load.View = fileDataItem.Options.AnzOptions.View; 
					break; 
 
				case RasterDialogFileOptionsType.Vector: 
					rasterCodecs.Options.Vector.Load.BackgroundColor = fileDataItem.Options.VectorOptions.Options.BackgroundColor; 
					rasterCodecs.Options.Vector.Load.BitsPerPixel = fileDataItem.Options.VectorOptions.Options.BitsPerPixel; 
					rasterCodecs.Options.Vector.Load.ForceBackgroundColor = fileDataItem.Options.VectorOptions.Options.ForceBackgroundColor; 
					rasterCodecs.Options.Vector.Load.ViewHeight = fileDataItem.Options.VectorOptions.Options.ViewHeight; 
					rasterCodecs.Options.Vector.Load.ViewMode = fileDataItem.Options.VectorOptions.Options.ViewMode; 
					rasterCodecs.Options.Vector.Load.ViewWidth = fileDataItem.Options.VectorOptions.Options.ViewWidth; 
					break; 
			} 
 
			rasterCodecs.Options.Load.Passes = fileDataItem.Passes; 
			rasterCodecs.Options.Load.Rotated = fileDataItem.LoadRotated; 
			rasterCodecs.Options.Load.Compressed = fileDataItem.LoadCompressed; 
 
			RasterImage loadedImage = rasterCodecs.Load(fileDataItem.Name, 
			   0, 
			   CodecsLoadByteOrder.BgrOrGray, 
			   fileDataItem.PageNumber, 
			   fileDataItem.PageNumber); 
 
			// COPY THE 'loadedImage' IMAGE. 
 
			loadedImage.Dispose(); 
		} 
	} 
} 
public void openDlg_Help(object sender, RasterDialogHelpEventArgs e) 
{ 
	switch (e.Dialog) 
	{ 
		case RasterDialogHelpName.Open: 
			{ 
				MessageBox.Show("Open dialog Help"); 
				break; 
			} 
 
		case RasterDialogHelpName.LoadOptions: 
			{ 
				MessageBox.Show("Load Options dialog Help"); 
				break; 
			} 
	} 
} 
 
public void openDlg_LoadProgress(object sender, RasterDialogLoadProgressEventArgs e) 
{ 
	string displayText; 
 
	displayText = "(" + e.FilePercent.ToString() + "%) of" + e.LoadRasterFileData.Name + "file is loaded"; 
	MessageBox.Show(displayText); 
 
	displayText = "(" + e.TotalPercent.ToString() + "%) of all file(s) loading process is completed"; 
	MessageBox.Show(displayText); 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.WinForms.CommonDialogs.File Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.