public PdfWriter(string fileName, Size pageSize, Rect drawingBounds) { double ymax = drawingBounds.Bottom; double ymin = drawingBounds.Top; double xmax = drawingBounds.Right; double xmin = drawingBounds.Left; m_scale = Math.Min(pageSize.Width / (xmax - xmin), pageSize.Height / (ymax - ymin)); m_dx = -xmin; m_dy = -ymin; m_pdfDocument = new ITextPdf.PdfDocument(new iText.Kernel.Pdf.PdfWriter(fileName)); m_canvas = new ITextCanvas.PdfCanvas(m_pdfDocument.AddNewPage(new ITextGeom.PageSize((float)pageSize.Width, (float)pageSize.Height))); }