C# PDF - PDF Creating in C#.NET
Tell Users How to Create New PDF File and Load PDF from Other Files
C#.NET PDF document file creating library control, RasterEdge XDoc.PDF SDK for .NET, is a robust & thread-safe .NET solution which provides a reliable and quick approach for C# developers to create a highly-secure and industry-standard PDF document file. The PDF document file created by RasterEdge C# PDF document creator library is searchable and can be fully populated with editable text and graphics programmatically.
This Visual C# .NET PDF document creation control toolkit can not only allow developers to generate standard PDF document file but also offer them the ability to count the page numbers of generated PDF document by simple C# programming code. As this PDF document creator library is built in .NET Framework 2.0 and designed specifically for .NET applications, C# developers can easily use this professional PDF document generating SDK in all .NET developing applications, including ASP.NET web services and Windows Forms application.
After creating a PDF document in C#.NET using this PDF document creating toolkit, if you need to add some text and draw some graphics on created PDF document file, you can also use this C#.NET PDF document drawing library control. Besides, using this PDF document metadata adding control, you can add some additional information to generated PDF file. What's more, you can also protect created PDF file by adding digital signature (watermark) on PDF using C# code.
Create PDF Document from Existing Files Using C#
Create PDF from Microsoft Word, Excel, PowerPoint
Create PDF from Tiff
Create PDF from Jpeg, png, images
Create PDF from Open Office files
Create PDF from CSV
Create a new PDF Document with one Blank Page in C# Project
In C# class programming, you can use specific APIs to create PDF file. And the PDF document can contain one empty page or multiple empty pages. The following example will tell you how to create a PDF document with 2 empty pages.
String outputFile = Program.RootPath + "\\" + "output.pdf";
// Create a new PDF Document object with 2 blank pages
PDFDocument doc = PDFDocument.Create(2);
// Save the new created PDF document into file
Load PDF Document from existing PDF file Using C#
You may also load or create a PDF document object from existing PDF file in C#.net.
// Load from a file
String inputFilePath1 = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc1 = new PDFDocument(inputFilePath1);
if (doc1 == null) throw new Exception("fail to load the file");
Load PDF from Stream object in C# Project
PDF document can be loaded from a stream object in C# programming.
// Load from a stream
String inputFilePath2 = Program.RootPath + "\\" + "2.pdf";
using (FileStream fileStream = File.Open(inputFilePath2, FileMode.Open, FileAccess.Read))
PDFDocument doc2 = new PDFDocument(fileStream);
if (doc2 == null) throw new Exception("fail to load PDF document from the stream");