Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri May 19, 2017 11:24 am

Hello,

i'm using the following Code io to print pdfs using the PrintDialog to change some Settings before subbmitting print orders.

Dim pDialog As PrintDialog = New PrintDialog
pDialog.AllowPrintToFile = True
pDialog.AllowSomePages = True
pDialog.PrinterSettings.MinimumPage = 1
pDialog.PrinterSettings.MaximumPage = doc.Pages.Count
pDialog.PrinterSettings.FromPage = 1
pDialog.PrinterSettings.ToPage = doc.Pages.Count
pDialog.PrinterSettings.PrinterName = strPrinter

If pDialog.ShowDialog = DialogResult.OK Then
doc.PrintFromPage = pDialog.PrinterSettings.FromPage
doc.PrintToPage = pDialog.PrinterSettings.ToPage
doc.PrinterName = pDialog.PrinterSettings.PrinterName
Dim pd As PrintDocument = doc.PrintDocument
pd.DocumentName = Path.GetFileNameWithoutExtension(strPdfSrc)
pDialog.Document = pd
pd.Print()
End If

How can i implement Duplex, draft and Color/black print?
Rgds
Thomas

tgrote
 
Posts: 8
Joined: Sat Nov 19, 2016 8:41 am

Mon May 22, 2017 3:51 am

Hello,

Thanks for your inquiry.
Concerning your requirements, firstly, our Spire.PDF supports duplex print.
Please refer to the following code:
Code: Select all
'###1 Dduplex print
'Indicate whether the printer supports duplex
Dim isDuplex As Boolean = pDialog.PrinterSettings.CanDuplex
'If so, set the printer's duplex setting: Default, Simplex, Horizontal, Vertical
if (isDuplex)
{
pDialog.PrinterSettings.Duplex = Duplex.[Default]
}

As for the draft printing, sorry it is not available at present.
Then, about black and white print, if the printer supports color print, it will apply color print in default. In regards to the black&white print setting on the color supported printer, it seems that there's something wrong with this feature and I have referred it to our dev team. Once there's any update, we will notify you.

Sinerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Jul 05, 2017 9:54 am

Hello Thomas,

Since there's no color printer on our side for testing. we suggest you trying the folliwing code to apply black and white print.
Code: Select all
'###Black&White print
'First judge if the printer supports color printing
Dim isColorSupported As Boolean = pDialog.PrinterSettings.SupportsColor
'set the PageSettings.Color accordingly
If isColorSupported Then
   printDoc.DefaultPageSettings.Color = False 'Here you could try both true and false to see the difference
End If

I am looking foeward to your reply.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Mar 15, 2018 9:51 am

Hello,

Gald to inform the black and white printing is supported in Spire.PDF Pack(Hot Fix) Version:4.3.4.
Code: Select all
PdfDocument doc = new PdfDocument("path");
doc.PrintSettings.Color = false;
doc.Print();


Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.PDF