Winnovative PDF Print for .NET 7.1 Retail
Winnovative PDF Print for .NET 7.1 Retail
Winnovative PDF Print can be used in any type of .NET application to silently print PDF documents. The integration with existing .NET applications is extremely easy and no installation is necessary. The downloaded archive contains the assembly for .NET and a demo application. The full C# source code for the demo application is available in the Samples folder. You can select the printer, set the paper size, orientation and margins, print in color or in gray scale, select the range of PDF pages to print. Winnovative PDF Print does not depend on Adobe Reader or other third party tools.
Features
Print PDF documents from files, streams or memory buffers
Silently print without displaying any print dialog
Does not depend on Adobe Reader or other third party tools
Allows you to select the printer to be used for printing
Allows you to select the paper size, orientation and margins
Print password protected PDF documents
Add watermarks and stamps during printing
Print only a range of PDF pages
Get the number of pages in a PDF document
Support for .NET 4.0 framework and later
Documentation and C# samples for all the features
Code Sample for PDF Print
The code below was taken from the PDF Print demo application available for download in the PDF Print product package. In this sample an instance of the PdfPrint class is constructed and used to silently print a selected PDF document.
private void btnPrintPdf_Click(object sender, EventArgs e)
{
if (pdfFileTextBox.Text.Trim().Equals(String.Empty))
{
MessageBox.Show("Please choose a source PDF file", "Choose PDF file", MessageBoxButtons.OK);
return;
}
// the source pdf file
string pdfFileName = pdfFileTextBox.Text.Trim();
// start page number
int startPageNumber = int.Parse(textBoxStartPage.Text.Trim());
// end page number
// when it is 0 the conversion will continue up to the end of document
int endPageNumber = 0;
if (textBoxEndPage.Text.Trim() != String.Empty)
endPageNumber = int.Parse(textBoxEndPage.Text.Trim());
// create the PDF printer
PdfPrint pdfPrint = new PdfPrint();
// set the license key
pdfPrint.LicenseKey = "OrSltaGgtaW1o7ultaaku6Snu6ysrKy1pQ==";
// set the document name
pdfPrint.DocumentName = "PDF Silent Printing";
// enable or disable color printing
pdfPrint.DefaultPageSettings.Color = cbPrintColor.Checked;
// set the PDF printing color and resolution
pdfPrint.Color = GetSelectedPrintColor();
pdfPrint.Resolution = int.Parse(textBoxResolution.Text);
// select the printer
string selectedPrinterName = GetSelectedPrinterName();
if (selectedPrinterName != null)
pdfPrint.PrinterSettings.PrinterName = selectedPrinterName;
// set paper size
PaperSize selectedPaperSize = GetSelectedPaperSize();
if (selectedPaperSize != null)
pdfPrint.DefaultPageSettings.PaperSize = selectedPaperSize;
// set paper orientation
pdfPrint.DefaultPageSettings.Landscape = GetSelectedPageOrientation() == "Landscape";
// set paper margins
pdfPrint.DefaultPageSettings.Margins = new Margins((int)(float.Parse(leftMarginTextBox.Text) * 100),
(int)(float.Parse(rightMarginTextBox.Text) * 100),
(int)(float.Parse(topMarginTextBox.Text) * 100),
(int)(float.Parse(bottomMarginTextBox.Text) * 100));
// the demo output directory
string outputDirectory = Path.Combine(Application.StartupPath, @"DemoFiles\Output");
Cursor = Cursors.WaitCursor;
try
{
pdfPrint.Print(pdfFileName, startPageNumber, endPageNumber);
}
catch (Exception ex)
{
// The conversion failed
MessageBox.Show(String.Format("An error occurred. {0}", ex.Message), "Error");
return;
}
finally
{
Cursor = Cursors.Arrow;
}
MessageBox.Show("Print Completed", "Print Completed", MessageBoxButtons.OK);
}
Only for V.I.P
Warning! You are not allowed to view this text.