private IntPtr InitDocument() { if (!_useDP) { return(_pdfDoc.Handle); } _printHandle = Pdfium.FPDFPRINT_Open( _pdfDoc.Handle, string.Format("{0}-{1}", PrinterSettings.FromPage, PrinterSettings.ToPage), DefaultPageSettings.PaperSize.Width / 100 * 72, DefaultPageSettings.PaperSize.Height / 100 * 72, (int)((double)DefaultPageSettings.PrintableArea.X / 100 * 72), (int)((double)DefaultPageSettings.PrintableArea.Y / 100 * 72), (int)((double)DefaultPageSettings.PrintableArea.Width / 100 * 72), (int)((double)DefaultPageSettings.PrintableArea.Height / 100 * 72), PrintScallingMode.PrintableArea); if (_printHandle == IntPtr.Zero) { return(IntPtr.Zero); } _docForPrint = Pdfium.FPDFPRINT_GetDocument(_printHandle); if (_docForPrint == IntPtr.Zero) { return(IntPtr.Zero); } return(_docForPrint); }