By Vidya Vrat Agarwal Sir…
In this article you can learn various image operations using a PDF document in C# programming. We are going to create a simple PDF grid and show you how to insert an image to a specific PDF grid cell in C#. Images are more attractive for reading the document. Images are related to the contents. Sometimes, an image can describe some content more clearly, like using a chart to show data changes in a period.
Spire.PDF for .NET is a professional .NET PDF component to quickly generate, open, modify and save PDF documents without using Office Automation and enables users to insert an image into PDF and set its size depending on the page using C#. How to draw nested grid in PDF document and set grid row & cell format. This guide introduces an easy method for inserting an image via Spire.PDF for .NET.
Create a ConsoleApplication for the demo. Use the following procedure:
- Open Visual Studio
- “File” -> “New” -> “Project…”
- Select C# Language then select ConsoleApplication and name it “ImageIntoPDF”
- Click OK.
- Add following code in Program.cs file
static void Main(string args)
string outputFile = @”..\..\output.pdf”;
//Create a pdf document
PdfDocument doc = new PdfDocument();
//Add a page for the pdf document
PdfPageBase page = doc.Pages.Add();
//Create a pdf grid
PdfGrid grid = new PdfGrid();
//Set the cell padding of pdf grid
grid.Style.CellPadding = new PdfPaddings(1, 1, 1, 1);
//Add a row for pdf grid
PdfGridRow row = grid.Rows.Add();
//Add two columns for pdf grid
float width = page.Canvas.ClientSize.Width – (grid.Columns.Count + 1);
//Set the width of the first column
grid.Columns.Width = width * 0.25f;
grid.Columns.Width = width * 0.25f;
//Add a image
PdfGridCellTextAndStyleList lst = new PdfGridCellTextAndStyleList();
PdfGridCellTextAndStyle textAndStyle = new PdfGridCellTextAndStyle();
textAndStyle.Image = PdfImage.FromFile(“..\\..\\image1.jpg”);
//Set the size of image
textAndStyle.ImageSize = new SizeF(50, 50);
//Add a image into the first cell.
row.Cells.Value = lst;
//Draw pdf grid into page at the specific location
PdfLayoutResult result = grid.Draw(page, new PointF(10, 30));
//Save to a pdf file
I hope you now understand how to insert images in PDF documents programmatically. If you have any suggestion regarding this article then please contact me.
Contents used from Spire.Doc for more information click here.
[Notes from Pinal]: Data is a very simple word, yet it is very powerful. There is a famous saying – Know Your Data. I have quite often found that developers do not know their data, they are often confused with the same and not sure how to answer that. My friend Tim Radney is an amazing person who usually haveanswer to each of the questions which looks simple but are complicated in reality.
Linchpin People are database coaches and wellness experts for a data driven world. In this 50th episode of the Notes from the Fields series database expert Tim Radney (partner at Linchpin People) explains in a very simple word. Please follow Tim on his twitter handle at @tradney.
Do you know your data’s classification?
As data professionals, we have many responsibilities. We could be responsible for backing up and restoring data, writing reports, building queries, writing stored…
View original post 250 more words
It has been a long time since SQL Server 2008 got Service Pack Update. Microsoft has finally released SQL Server 2008 service pack 4 and its feature pack. SQL Server 2008 SP4 contains fixes to issues reported as well as Hotfix solutions have provided since SQL Server 2008 Service Pack 2 up to and including Cumulative Update 13.
I have personally switched to SQL Server 2014 few months ago and I am happy with its performance and robust behavior. Many of the customer and clients are still using SQL Server 2012. However, if you are using SQL Server 2008, I suggest that you look at upgrading to the latest version of SQL Server or at least update your software with latest service pack.
You can download SQL Server 2008 Service Pack from following link:
Reference: Pinal Dave (http://blog.sqlauthority.com)
Backup is extremely important for any DBA. Think of any disaster and backup will come to rescue users in adverse situation. Similarly, it is very critical that we keep our backup safe as well. If your backup fall in the hands of bad people, it is quite possible that it will be misused and become serious data integrity issue. Well, in this blog post we will see a practical scenario where we will see how we can use Backup Encryption to improve security of the bakcup.
Database Backup Encryption is a brand new and long expected feature that is available now in SQL Server 2014. You can create an encrypted backup file by specifying the encryption algorithm and the encryptor (either a Certificate or Asymmetric Key).
The ability to protect a backup file with the password has been existing for many years. If you use SQL Server for a long…
View original post 738 more words