How to Get PDF Height and Width
Hi Guys,
Can you please let me know how I can get the Height and Width of a PDF document using C#.I google this and i find out I can do this using the iTextSharp but I do not know how to do that.
What I have till now is:
private void btnOpen_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
txtFileName.Text = dialog.FileName;
txtFileAdd.Text = dialog.SafeFileName;
PdfReader reader = new PdfReader(dialog.SafeFileName);
PdfImportedPage page = writer.GetImportedPage(reader, i);
// size information
txtFileWidth .Text= page.PageSize.Width;
txtFileHeight .Text = page.PageSize.Height;
}
}
as you can see I am getting error on writer, which make sense but I do not know how to declare it!
Thanks alot