Generate, view, and print PDF files in your .NET applications in one place with ComponentOne PDF Tools.
ComponentOne PDF is a .NET library that supports advanced features that are part of PDF specification, which can help you create a PDF file in your application.
After creating a PDF file, you can load that file using ComponentOne PDFDocumentSource, a library that can load and view your PDF in FlexViewer in your .NET application. PDFDocumentSource can also independently search keywords in your PDF, as well as export and print your PDF files. In addition to PDFs generated from C1PDF, FlexViewer can also load any PDF.
FlexViewer is a flexible viewer that can load reports and documents like C1FlexReport, SSRS Reports, and PDF files. It also offers powerful features for viewing documents. Please see more information about FlexViewer here.link to flexviewer page
Because all of the above tools are cross-platform, you can generate, view, and print PDF files in any of the Winforms, WPF, and UWP applications.
Suppose you want to put various images of your office locations in a single file and store it in a PDF. You also want to load this PDF at run time and print it. You can do this in a WinForms application using the following steps (as well as a WPF or UWP application):
//Create C1PdfDocument
C1.C1Pdf.C1PdfDocument pdf = new C1.C1Pdf.C1PdfDocument();
//Create Font that would add Office Location title.
Font font = new Font("Calibri", 16, FontStyle.Underline);
//Create Rectangle area in which the image would be drawn
RectangleF rc = pdf.PageRectangle;
rc.Inflate(-72, -72);
//Define Image to be used
var image = Image.FromFile(@"..\\..\\GrapeCity Sendai.jpg");
//Draw the Image
pdf.DrawImage(image, rc,ContentAlignment.TopLeft, C1.C1Pdf.ImageSizeModeEnum.Scale);
//Add Office title
pdf.DrawString("GrapeCity Sendai", font, Brushes.Black, new PointF(220, 20));
//Create new page
pdf.NewPage();
//Create Rectangle area, define the image, draw the image and add Office Title
RectangleF rc1 = pdf.PageRectangle;
var image1 = Image.FromFile(@"..\\..\\GrapeCity Sendai in Winters.jpg");
rc.Inflate(-72, -72);
pdf.DrawImage(image1, rc1, ContentAlignment.TopLeft, C1.C1Pdf.ImageSizeModeEnum.Scale);
pdf.DrawString("GrapeCity Sendai in Winters", font, Brushes.Black, new PointF(20, 20));
//Create new page
pdf.NewPage();
//Create Rectangle area, define the image, draw the image and add Office Title.
RectangleF rc2 = pdf.PageRectangle;
rc.Inflate(-72, -72);
var image2 = Image.FromFile(@"..\\..\\GrapeCity Sendai Wine Studios.jpg");
pdf.DrawImage(image2, rc2, ContentAlignment.TopLeft, C1.C1Pdf.ImageSizeModeEnum.Scale);
pdf.DrawString("GrapeCity Sendai Wine Studios", font, Brushes.Black, new PointF(20, 20));
//Create new page
pdf.NewPage();
//Create Rectangle area, define the image, draw the image and add Office Title.
RectangleF rc3 = pdf.PageRectangle;
rc.Inflate(-72, -72);
var image3 = Image.FromFile(@"..\\..\\GrapeCity Sendai Outside View.jpg");
pdf.DrawImage(image3, rc3, ContentAlignment.TopLeft, C1.C1Pdf.ImageSizeModeEnum.Scale);
pdf.DrawString("GrapeCity Sendai Outside View", font, Brushes.Black, new PointF(20, 20));
string fileName = "GrapeCity Sendai.pdf";
pdf.Save(fileName);
C1.Win.C1Document.C1PdfDocumentSource pdfdoc = new C1.Win.C1Document.C1PdfDocumentSource();
pdfdoc.LoadFromFile("GrapeCity Sendai.pdf");
c1FlexViewer1.DocumentSource = pdfdoc;
This is what your PDF file should look like: * Step 6: To print the file, simply click the Print button on FlexViewer.
Please note that your application references the following DLLs when running the above example:
Learn more about C1PDF here. Learn more about the C1PDFDocumentSource component here.should link to corresponding pages.