Class ExcelToPdfConverterSettings
Inheritance
Namespace: Syncfusion.ExcelToPdfConverter
Assembly: Syncfusion.ExcelToPDFConverter.Base.dll
Syntax
public class ExcelToPdfConverterSettings : Object
Constructors
ExcelToPdfConverterSettings()
Initializes a new instance of the ExcelToPdfConverterSettings class.
Declaration
public ExcelToPdfConverterSettings()
Properties
AutoDetectComplexScript
Gets or sets a value to enable complex script validation for the text present in the Excel document and render it in PDF conversion. Default value is FALSE.
Declaration
public bool AutoDetectComplexScript { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
using Syncfusion.XlsIO;
using System.Text;
using Syncfusion.Pdf;
using Syncfusion.ExcelToPdfConverter;
class Example
{
static void Main()
{
using(ExcelEngine engine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Fund_Calendar_KF-US_2018.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ExcelToPdfConverterSettings setting = new ExcelToPdfConverterSettings();
setting.AutoDetectComplexScript = true;
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
PdfDocument doc = converter.Convert(setting);
doc.Save("Output.pdf");
}
}
}
AutoTag
Gets or sets a boolean value indicating whether the accessibility tags should be enabled in the converted PDF document. Default value is false
Declaration
public bool AutoTag { get; set; }
Property Value
Type |
---|
System.Boolean |
CustomPaperSize
Gets or sets a Custom paper size in inches. The default value is empty(i.e.,{Width = 0.0 Height = 0.0})
Declaration
public SizeF CustomPaperSize { get; set; }
Property Value
Type |
---|
System.Drawing.SizeF |
Examples
The following code snippet illustrates how to set the custom page size for the document.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//Open the file as Stream
FileStream excelStream = new FileStream("Template.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(excelStream);
ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings();
//Setting custom paper size to the document
settings.CustomPaperSize = new SizeF(10, 20);
//Convert the workbook into PDF.
PdfDocument document = converter.Convert(settings);
//Saving the PDF as stream
FileStream stream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite);
document.Save(pdfStream);
pdfStream.Dispose();
excelStream.Dispose();
document.Close();
workbook.Close();
excelEngine.Dispose();
DisplayGridLines
Gets or sets the style of grid lines.
Declaration
public GridLinesDisplayStyle DisplayGridLines { get; set; }
Property Value
Type |
---|
GridLinesDisplayStyle |
EmbedFonts
True if the font is an embedded font. The default value is False.
Declaration
public bool EmbedFonts { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableFormFields
Gets or sets value to indicate whether the PDF rendering to be done by form fields or not.
Declaration
public bool EnableFormFields { get; set; }
Property Value
Type |
---|
System.Boolean |
ExportBookmarks
Gets or sets a value indicating whether to export bookmarks. The default value is True.
Declaration
public bool ExportBookmarks { get; set; }
Property Value
Type |
---|
System.Boolean |
ExportDocumentProperties
Gets or sets a value indicating whether to export document properties. The default value is True.
Declaration
public bool ExportDocumentProperties { get; set; }
Property Value
Type |
---|
System.Boolean |
ExportQualityImage
Gets or sets a value indicating whether to export quality image. The default value is False.
Declaration
public bool ExportQualityImage { get; set; }
Property Value
Type |
---|
System.Boolean |
HeaderFooterOption
Gets the header and footer option.
Declaration
public HeaderFooterOption HeaderFooterOption { get; }
Property Value
Type |
---|
HeaderFooterOption |
IsConvertBlankPage
Gets or sets a value indicating whether to convert blank PDF page. The default value is true.
Declaration
public bool IsConvertBlankPage { get; set; }
Property Value
Type |
---|
System.Boolean |
IsConvertBlankSheet
Gets or sets a value indicating whether to convert blank sheet. The default value is true.
Declaration
public bool IsConvertBlankSheet { get; set; }
Property Value
Type |
---|
System.Boolean |
LayoutOptions
Gets or sets the layout mode.
Declaration
public LayoutOptions LayoutOptions { get; set; }
Property Value
Type | Description |
---|---|
LayoutOptions | The layout mode. |
Examples
The following code snippet illustrates how to set the lay out options.
using Syncfusion.XlsIO;
using Syncfusion.ExcelToPdfConverter;
class Example
{
static void Main()
{
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
ExcelToPdfConverterSettings converterSettings = new ExcelToPdfConverterSettings();
converterSettings.LayoutOptions = LayoutOptions.FitAllColumnsOnOnePage;
PdfDocument doc = converter.Convert(converterSettings);
doc.Save("Output.pdf");
}
}
}
PdfConformanceLevel
Gets or sets the Pdf document's Conformance-level.
Declaration
public PdfConformanceLevel PdfConformanceLevel { get; set; }
Property Value
Type | Description |
---|---|
PdfConformanceLevel | The PdfConformanceLevel of the PDF document. |
Examples
The following code snippet illustrates how to set set the PdfConformanceLevel while converting Excel workbook to PDF.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open(DEFAULTPATH + "sample.xlsx");
//Open the Excel document to Convert
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings();
// Set the conformance for PDF/A-1b conversion.
settings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B;
//Initialize PDF document
PdfDocument pdfDocument = converter.Convert(settings);
//Save the PDF file
pdfDocument.Save("Output.pdf");
pdfDocument.Close();
RenderBySheet
Gets or sets value to indicate whether the PDF rendering to be done sheet-by-sheet or not.
Declaration
public bool RenderBySheet { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowFileNameWithExtension
Gets or sets a value indicating whether to display the file extension along with file name in the header footer or not, when converting an Excel to PDF. The default value is false.
Declaration
public bool ShowFileNameWithExtension { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
using Syncfusion.XlsIO;
using System.Text;
using Syncfusion.Pdf;
using Syncfusion.ExcelToPdfConverter;
class Example
using(ExcelEngine engine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Fund_Calendar_KF-US_2018.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ExcelToPdfConverterSettings setting = new ExcelToPdfConverterSettings();
setting.ShowFileNameWithExtension = true;
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
PdfDocument doc = converter.Convert(setting);
doc.Save("Output.pdf");
}
TemplateDocument
Gets or sets the PDF template document.
Declaration
public PdfDocument TemplateDocument { get; set; }
Property Value
Type |
---|
PdfDocument |
ThrowWhenExcelFileIsEmpty
Gets or sets a value indicating whether to throw exception when empty Excel document is being converted to a PDF document.
Declaration
public bool ThrowWhenExcelFileIsEmpty { get; set; }
Property Value
Type |
---|
System.Boolean |
Warning
Declaration
public IWarning Warning { get; set; }
Property Value
Type |
---|
IWarning |