Samples: Document Settings

   Minimize
  Document Settings Sample for C# / VB.NET


Download the sample here
 
[C#]
//Create a new PDF Document. The pdfDoc object represents the PDF document.
//This document has one page by default and additional pages have to be added.
PdfDocumentBuilder builder = new PdfDocumentBuilder();
IPdfDocument pdfDoc = builder.CreateDocument();
IPdfPage page = pdfDoc.Pages.AddNew();
//Setting various Document properties.
pdfDoc.DocumentInformation.Title = "Document Settings";
pdfDoc.DocumentInformation.Author = "Nasosoft Ltd.";
pdfDoc.DocumentInformation.Keywords = "Pdf document settings";
pdfDoc.DocumentInformation.Subject = "Pdf document settings";
pdfDoc.DocumentInformation.Producer = "Nasosoft.Documents.Pdf";
pdfDoc.DocumentInformation.CreationDate = DateTime.Now;
IPdfFont font = builder.FontFactory.CreateStandardFont(PdfStandardFontFamilies.Helvetica, 10f);
IPdfFont boldFont = builder.FontFactory.CreateStandardFont(PdfStandardFontFamilies.Helvetica, 12f, PdfFontStyle.Bold);
IPdfBrush brush = PdfBrushFactory.Black;
IPdfGraphics g = page.Graphics;
g.DrawString("Pdf Document Settings Sample", boldFont, brush, 10, 10);
g.DrawString("Empowered by Nasosoft.Documents.Pdf", boldFont, brush, 10, 50);
pdfDoc.Save(fileName);
[VB.NET]
'Create a new PDF Document. The pdfDoc object represents the PDF document. 
'This document has one page by default and additional pages have to be added.
Dim builder As New PdfDocumentBuilder()
Dim pdfDoc As IPdfDocument = builder.CreateDocument()
Dim page As IPdfPage = pdfDoc.Pages.AddNew()
'Setting various Document properties. 
pdfDoc.DocumentInformation.Title = "Document Settings"
pdfDoc.DocumentInformation.Author = "Nasosoft Ltd."
pdfDoc.DocumentInformation.Keywords = "Pdf document settings"
pdfDoc.DocumentInformation.Subject = "Pdf document settings"
pdfDoc.DocumentInformation.Producer = "Nasosoft.Documents.Pdf"
pdfDoc.DocumentInformation.CreationDate = DateTime.Now
Dim font As IPdfFont = builder.FontFactory.CreateStandardFont(PdfStandardFontFamilies.Helvetica, 10.0F)
Dim boldFont As IPdfFont = builder.FontFactory.CreateStandardFont(PdfStandardFontFamilies.Helvetica, 12.0F, PdfFontStyle.Bold)
Dim brush As IPdfBrush = PdfBrushFactory.Black
Dim g As IPdfGraphics = page.Graphics
g.DrawString("Pdf Document Settings Sample", boldFont, brush, 10, 10)
g.DrawString("Empowered by Nasosoft.Documents.Pdf", boldFont, brush, 10, 50)
pdfDoc.Save(fileName)