Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142941 | Feb 26,2019 12:49 PM UTC | Feb 27,2019 01:24 PM UTC | ASP.NET Core - EJ 2 | 1 |
![]() |
Tags: PDF |
//Create a new PDF document
PdfDocument pdfDocument = new PdfDocument();
//Add page to the PDF document
PdfPage pdfPage = pdfDocument.Pages.Add();
//Create a new PdfGrid
PdfGrid pdfGrid = new PdfGrid();
//Add three columns
pdfGrid.Columns.Add(3);
//Add header
pdfGrid.Headers.Add(1);
PdfGridRow pdfGridHeader = pdfGrid.Headers[0];
pdfGridHeader.Cells[0].Value = "Employee ID";
pdfGridHeader.Cells[1].Value = "Employee Name";
pdfGridHeader.Cells[2].Value = "Salary";
//Add rows
PdfGridRow pdfGridRow = pdfGrid.Rows.Add();
pdfGridRow.Cells[0].Value = "E01";
pdfGridRow.Cells[1].Value = "Clay";
pdfGridRow.Cells[2].Value = "$10,000";
//Load the image from the stream
FileStream fs = new FileStream(@"Image file path", FileMode.Open);
//Apply style
PdfGridCell pdfGridCell = pdfGrid.Rows[0].Cells[0];
//Set the cell value as the bitmap image
pdfGridCell.Value = new PdfBitmap(fs);
pdfGrid.Rows[0].Height = 50;
//Draw the PdfGrid
pdfGrid.Draw(pdfPage, PointF.Empty);
MemoryStream ms = new MemoryStream();
//Save the document
pdfDocument.Save(ms);
//Close the document
pdfDocument.Close(true); |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.