// Create a pdf file stream using FileStream outputStream = new FileStream("SetDocumentPropertiesToPDF.pdf", FileMode.Create); //create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1"].Value = "Document Solutions for Excel"; worksheet.Range["A1"].Font.Size = 25; DocumentProperties documentProperties = new DocumentProperties { //Sets the name of the person that created the PDF document. Author = "Jaime Smith", //Sets the title of the PDF document. Title = "Document Info Sample", //Do not embed a font. EmbedStandardWindowsFonts = false, //Set the PDF version. PdfVersion = 1.5f, //Set the subject of the PDF document. Subject = "DocumentInfo", //Set the keyword associated with the PDF document. Keywords = "Keyword1", //Set the creation date and time of the PDF document. CreationDate = DateTime.Now.AddYears(10), //Set the date and time the PDF document was most recently modified. ModifyDate = DateTime.Now.AddYears(11), //Set the name of the application that created the original PDF document. Creator = "Creator", //Set the name of the application that created the PDF document. Producer = "Producer" }; PdfSaveOptions pdfSaveOptions = new PdfSaveOptions { //Sets the document properties of the pdf. DocumentProperties = documentProperties }; //Save the workbook into pdf file. workbook.Save(outputStream, pdfSaveOptions); // close the pdf stream outputStream.Close();
' Create a pdf file stream Dim outputStream = File.Create("SetDocumentPropertiesToPDF.pdf") ' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) worksheet.Range!A1.Value = "Document Solutions for Excel" worksheet.Range!A1.Font.Size = 25 Dim documentProperties As New DocumentProperties With documentProperties 'Sets the name of the person that created the PDF document. .Author = "Jaime Smith" 'Sets the title of the PDF document. .Title = "Document Info Sample" 'Do not embed a font. .EmbedStandardWindowsFonts = False 'Set the PDF version. .PdfVersion = 1.5F 'Set the subject of the PDF document. .Subject = "DocumentInfo" 'Set the keyword associated with the PDF document. .Keywords = "Keyword1" 'Set the creation date and time of the PDF document. .CreationDate = Date.Now.AddYears(10) 'Set the date and time the PDF document was most recently modified. .ModifyDate = Date.Now.AddYears(11) 'Set the name of the application that created the original PDF document. .Creator = "Creator" 'Set the name of the application that created the PDF document. .Producer = "Producer" End With 'Sets the document properties of the pdf. Dim pdfSaveOptions As New PdfSaveOptions With { .DocumentProperties = documentProperties } 'Save the workbook into pdf file. workbook.Save(outputStream, pdfSaveOptions) ' close the pdf stream outputStream.Close()