[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.PrintManager.SavePDF

SavePDF Method

SavePDF(Stream, IEnumerable<Workbook>, PdfSaveOptions)

Paginates each workbook and saves all generated pages to the specified PDF file stream.

Declaration
public void SavePDF(Stream stream, IEnumerable<Workbook> workbooks, PdfSaveOptions options = null)
Public Sub SavePDF(stream As Stream, workbooks As IEnumerable(Of Workbook), Optional options As PdfSaveOptions = Nothing)
Parameters
Type Name Description
Stream stream

The specified pdf file.

IEnumerable<Workbook> workbooks

The workbooks to save. The workbooks are processed in the order they appear in the list.

PdfSaveOptions options

Options for saving pdf file.

Examples
worksheet.PageSetup.PrintArea = "B2:D6";
worksheet.Range["B2:D6"].Value = "Test";
Workbook secondWorkbook = new Workbook();
secondWorkbook.Worksheets[0].Range["B2"].Value = "Summary";
List<Workbook> workbooks = new List<Workbook> { workbook, secondWorkbook };
PrintManager printManager = new PrintManager();
using (MemoryStream stream = new MemoryStream())
{
    printManager.SavePDF(stream, workbooks, new PdfSaveOptions());
}

SavePDF(Stream, params Workbook[])

Paginates each workbook and saves all generated pages to the specified PDF file stream.

Declaration
public void SavePDF(Stream stream, params Workbook[] workbooks)
Public Sub SavePDF(stream As Stream, ParamArray workbooks As Workbook())
Parameters
Type Name Description
Stream stream

The specified pdf file.

Workbook[] workbooks

The workbook collection.

Examples
worksheet.PageSetup.PrintArea = "B2:D6";
worksheet.Range["B2:D6"].Value = "Test";
Workbook secondWorkbook = new Workbook();
secondWorkbook.Worksheets[0].Range["A1"].Value = "Second workbook";
PrintManager printManager = new PrintManager();
using (MemoryStream stream = new MemoryStream())
{
    printManager.SavePDF(stream, workbook, secondWorkbook);
}

SavePDF(string, IEnumerable<Workbook>, PdfSaveOptions)

Paginates each workbook and saves all generated pages to the specified PDF file.

Declaration
public void SavePDF(string fileName, IEnumerable<Workbook> workbooks, PdfSaveOptions options = null)
Public Sub SavePDF(fileName As String, workbooks As IEnumerable(Of Workbook), Optional options As PdfSaveOptions = Nothing)
Parameters
Type Name Description
string fileName

The specified pdf file.

IEnumerable<Workbook> workbooks

The workbook collection.

PdfSaveOptions options

Options for saving pdf file.

Examples
worksheet.Range["A1"].Value = "First workbook";
Workbook secondWorkbook = new Workbook();
secondWorkbook.Worksheets[0].Range["A1"].Value = "Second workbook";
List<Workbook> workbooks = new List<Workbook> { workbook, secondWorkbook };
PrintManager printManager = new PrintManager();
PdfSaveOptions options = new PdfSaveOptions();
string fileName = Path.Combine(Path.GetTempPath(), "Workbooks.pdf");
printManager.SavePDF(fileName, workbooks, options);

SavePDF(string, params Workbook[])

Paginates each workbook and saves all generated pages to the specified PDF file.

Declaration
public void SavePDF(string fileName, params Workbook[] workbooks)
Public Sub SavePDF(fileName As String, ParamArray workbooks As Workbook())
Parameters
Type Name Description
string fileName

The specified pdf file.

Workbook[] workbooks

The workbook collection.

Examples
worksheet.Range["A1"].Value = "First workbook";
Workbook secondWorkbook = new Workbook();
secondWorkbook.Worksheets[0].Range["A1"].Value = "Second workbook";
PrintManager printManager = new PrintManager();
string fileName = Path.Combine(Path.GetTempPath(), "Workbooks.pdf");
printManager.SavePDF(fileName, workbook, secondWorkbook);

SavePDF(string, IList<PageInfo>, PdfSaveOptions)

Saves the page datas to the specified pdf file.

Declaration
public void SavePDF(string fileName, IList<PageInfo> pages, PdfSaveOptions options = null)
Public Sub SavePDF(fileName As String, pages As IList(Of PageInfo), Optional options As PdfSaveOptions = Nothing)
Parameters
Type Name Description
string fileName

The specified pdf file.

IList<PageInfo> pages

The page information collection.

PdfSaveOptions options

Options for saving pdf file.

Examples
worksheet.PageSetup.PrintArea = "A1:B4";
worksheet.Range["A1:B4"].Value = new object[,]
{
    { "Name", "Value" },
    { "A", 100 },
    { "B", 200 },
    { "C", 300 }
};
PrintManager printManager = new PrintManager();
IList<PageInfo> pages = printManager.Paginate(worksheet);
string fileName = Path.Combine(Path.GetTempPath(), "WorksheetPages.pdf");
printManager.SavePDF(fileName, pages, new PdfSaveOptions());

SavePDF(Stream, IList<PageInfo>, PdfSaveOptions)

Saves the page datas to the specified pdf file stream.

Declaration
public void SavePDF(Stream stream, IList<PageInfo> pages, PdfSaveOptions options = null)
Public Sub SavePDF(stream As Stream, pages As IList(Of PageInfo), Optional options As PdfSaveOptions = Nothing)
Parameters
Type Name Description
Stream stream

The specified pdf file.

IList<PageInfo> pages

The page information collection.

PdfSaveOptions options

Options for saving pdf file.

Examples
worksheet.PageSetup.PrintArea = "A1:B4";
worksheet.Range["A1:B4"].Value = new object[,]
{
    { "Name", "Value" },
    { "A", 100 },
    { "B", 200 },
    { "C", 300 }
};
PrintManager printManager = new PrintManager();
IList<PageInfo> pages = printManager.Paginate(worksheet);
using MemoryStream stream = new MemoryStream();
printManager.SavePDF(stream, pages, new PdfSaveOptions());