public PdfPrintDocument(PdfDocument document, PdfPrintMode printMode)
        {
            if (document == null)
                throw new ArgumentNullException("document");

            _document = document;
            _printMode = printMode;
        }
Example #2
0
        public PdfPrintDocument(PdfDocument document, PdfPrintMode printMode)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            _document  = document;
            _printMode = printMode;
        }
Example #3
0
        public bool PrintDocument()
        {
            bool Printed = false;

            if (DocFile != string.Empty)
            {
                PdfPrintMode DefaultPrintMode = PdfPrintMode.CutMargin;

                using (var form = new PrintDialog())
                {
                    using (var document = pdfViewer.Document.CreatePrintDocument(DefaultPrintMode))
                    {
                        form.AllowSomePages = true;
                        form.Document       = document;
                        form.UseEXDialog    = true;
                        form.Document.PrinterSettings.FromPage = 1;
                        form.Document.PrinterSettings.ToPage   = pdfViewer.Document.PageCount;

                        if (form.ShowDialog(FindForm()) == DialogResult.OK)
                        {
                            try
                            {
                                if (form.Document.PrinterSettings.FromPage <= pdfViewer.Document.PageCount)
                                {
                                    form.Document.Print();
                                    Printed = true;
                                }
                            }
                            catch
                            {
                                // Ignore exceptions; the printer dialog should take care of this.
                            }
                        }
                    }
                }
            }
            return(Printed);
        }
Example #4
0
 /// <summary>
 /// Creates a <see cref="PrintDocument"/> for the PDF document.
 /// </summary>
 /// <param name="printMode">Specifies the mode for printing. The default
 /// value for this parameter is CutMargin.</param>
 /// <returns></returns>
 public PrintDocument CreatePrintDocument(PdfPrintMode printMode)
 {
     return(new PdfPrintDocument(this, printMode));
 }
Example #5
0
 /// <summary>
 /// Creates a new instance of the PdfPrintSettings class.
 /// </summary>
 /// <param name="mode">The mode used to print margins.</param>
 /// <param name="multiplePages">Configuration for printing multiple PDF
 /// pages on a single page.</param>
 public PdfPrintSettings(PdfPrintMode mode, PdfPrintMultiplePages multiplePages)
 {
     Mode          = mode;
     MultiplePages = multiplePages;
 }
Example #6
0
 /// <summary>
 /// Creates a <see cref="PrintDocument"/> for the PDF document.
 /// </summary>
 /// <param name="printMode">Specifies the mode for printing. The default
 /// value for this parameter is CutMargin.</param>
 /// <returns></returns>
 public PrintDocument CreatePrintDocument(PdfPrintMode printMode)
 {
     return(CreatePrintDocument(new PdfPrintSettings(printMode)));
 }
Example #7
0
 /// <summary>
 /// Creates a new instance of the PdfPrintSettings class.
 /// </summary>
 /// <param name="mode">The mode used to print margins.</param>
 /// <param name="scaleFactor">The scale factor.</param>
 /// <param name="multiplePages">Configuration for printing multiple PDF
 /// pages on a single page.</param>
 public PdfPrintSettings(PdfPrintMode mode, double scaleFactor, PdfPrintMultiplePages multiplePages) : this(mode, scaleFactor)
 {
     MultiplePages = multiplePages;
 }
Example #8
0
 /// <summary>
 /// Creates a new instance of the PdfPrintSettings class.
 /// </summary>
 /// <param name="mode">The mode used to print margins.</param>
 /// <param name="multiplePages">Configuration for printing multiple PDF
 /// pages on a single page.</param>
 public PdfPrintSettings(PdfPrintMode mode, PdfPrintMultiplePages multiplePages) : this(mode, 1.0, multiplePages)
 {
 }
Example #9
0
 /// <summary>
 /// Creates a new instance of the PdfPrintSettings class.
 /// </summary>
 /// <param name="mode">The mode used to print margins.</param>
 /// <param name="scaleFactor">The scale factor.</param>
 public PdfPrintSettings(PdfPrintMode mode, double scaleFactor)
 {
     Mode        = mode;
     ScaleFactor = scaleFactor;
 }
Example #10
0
 /// <summary>
 /// Creates a new instance of the PdfPrintSettings class.
 /// </summary>
 /// <param name="mode">The mode used to print margins.</param>
 public PdfPrintSettings(PdfPrintMode mode) : this(mode, 1.0)
 {
 }
Example #11
0
 public PrintDocument CreatePrintDocument(PdfPrintMode printMode)
 {
     return(_document.CreatePrintDocument(printMode));
 }
Example #12
0
 /// <summary>
 /// Creates a <see cref="PrintDocument"/> for the PDF document.
 /// </summary>
 /// <param name="printMode">Specifies the mode for printing. The default
 /// value for this parameter is CutMargin.</param>
 /// <returns></returns>
 public PrintDocument CreatePrintDocument(PdfPrintMode printMode)
 {
     return new PdfPrintDocument(this, printMode);
 }
Example #13
0
 /// <summary>Change the printmode for the rendering on an gdi+ device context.</summary>
 /// <param name="mode">Print mode.</param>
 public static void SetPrintMode(PdfPrintMode mode)
 {
     lock (FPDF_LibraryLock)
         FPDF_SetPrintMode((int)mode);
 }         // proc  SetPrintMode
Example #14
0
 public PrintDocument CreatePrintDocument(PdfPrintMode printMode)
 {
     throw new NotImplementedException();
 }
Example #15
0
 /// <summary>
 /// Creates a new instance of the PdfPrintSettings class.
 /// </summary>
 /// <param name="mode">The mode used to print margins.</param>
 /// <param name="multiplePages">Configuration for printing multiple PDF
 /// pages on a single page.</param>
 public PdfPrintSettings(PdfPrintMode mode, PdfPrintMultiplePages multiplePages, bool autoOrientation = true)
 {
     Mode            = mode;
     MultiplePages   = multiplePages;
     AutoOrientation = autoOrientation;
 }