|
Rank: Newbie Groups: Member
Joined: 10/9/2021 Posts: 3
|
Currently I'm testing PdfViewer in WPF application. Is there a way to change some settings in PrintDialog of PdfViewer before we show it to user? For example, I would like to change number of copies, duplexing option, paper size... and show that settings in PrintDialog as proposed for certain type od document in PdfViewer. User can change it after PrintDialog is shown.
|
|
Rank: Newbie Groups: Member
Joined: 10/9/2021 Posts: 3
|
At the end I used System.Windows.Forms.PrintDialog to send custom PrinterSettings to PDfViewer. It is working well, but I have some trouble when I try to print range of pages... For example, if I try to print pages from 3 to 5, that works well, but if I send just one page (range 1 to 1) PdfViewer prints all pages. Code where I set print range:
Code: C#
PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
System.Windows.Forms.PrintDialog pd = new System.Windows.Forms.PrintDialog();
pd.AllowSomePages = true;
if (pd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
//other settings
if(pd.PrinterSettings.PrintRange == PrintRange.SomePages)
{
printerSettings.PrintRange = PrintRange.SomePages;
printerSettings.FromPage = pd.PrinterSettings.FromPage;
printerSettings.ToPage = pd.PrinterSettings.ToPage;
printerSettings.MinimumPage = pd.PrinterSettings.MinimumPage;
printerSettings.MaximumPage = pd.PrinterSettings.MaximumPage;
}
pdfViewer.Print(printerSettings);
}
How to print only one page if user enter print range from 1 to 1?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, We have looked into this issue and found out that we did not translate the page index properly --- while Windows print dialog uses 1 based index numbers (first page has page number 1), the Chromium browser engine uses 0 based page numbers. So in a multiple page documents, when FromPage and ToPage is set to 1, the printing engine will actually print out the second page. We are not able to reproduce the case you reported though --- either printing the correct pages (such as from 3 to 4) or printing all pages. We will fix the page index translation issue and provide an update build as soon as possible. In the mean time, if you can create a test project that demonstrates the exact situation you saw, it would be very helpful for us to get to the bottom of this issue. See here for more information on how to send test project to us: https://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
This is just to let you know that we have posted a new build that should resolve the printing page index issue. You can download the new build from our download page.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 10/9/2021 Posts: 3
|
Thanks, I'll try new build.
|
|