473,698 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PrinterSettings .PrintRange, print only selected pages.

Hi, can anyone help me with the printrange functionality?

The problem is: whatever I try allways all the pages are print (directly to
the printer or via a preview control).

The VS-Build in help suggests checking the Printdocument.P rintPage event
during printing. And indeed I can check if the current page in the Printpage
event should be printed or not. But HOW to cancel the current page, if the
page should not be printed, rather than the printjob? I don't want blanc
pages.

Regards Coen.
Jun 13 '06 #1
2 3551
Coen,
Try putting some logic in the PrintPage event that will advance to the
next page if the page # is not in range before starting to draw the page.
And, of course, make sure to exit when no more pages are available. This is
how I do partial page range printing (although my exclusions are based on
page type normally). I just have a PrintPage event that manages the page
selection and doesn't do any drawing and then farms out the drawing to a
seperate method in the class.

Ron Allen
"Coen" <cb*****@newsgr oups.microsoft. com> wrote in message
news:3D******** *************** ***********@mic rosoft.com...
Hi, can anyone help me with the printrange functionality?

The problem is: whatever I try allways all the pages are print (directly
to
the printer or via a preview control).

The VS-Build in help suggests checking the Printdocument.P rintPage event
during printing. And indeed I can check if the current page in the
Printpage
event should be printed or not. But HOW to cancel the current page, if the
page should not be printed, rather than the printjob? I don't want blanc
pages.

Regards Coen.

Jun 13 '06 #2
Hi Ron, thanks for response.
The thing I don't understand is:

' Try putting some logic in the PrintPage event that will advance to the
next page if the page # is not in range before starting to draw the page.'

Not drawing the current page still causes a blank page. How to take care
that some pages (the not selected pages) are not created?

Coen
"Ron Allen" wrote:
Coen,
Try putting some logic in the PrintPage event that will advance to the
next page if the page # is not in range before starting to draw the page.
And, of course, make sure to exit when no more pages are available. This is
how I do partial page range printing (although my exclusions are based on
page type normally). I just have a PrintPage event that manages the page
selection and doesn't do any drawing and then farms out the drawing to a
seperate method in the class.

Ron Allen
"Coen" <cb*****@newsgr oups.microsoft. com> wrote in message
news:3D******** *************** ***********@mic rosoft.com...
Hi, can anyone help me with the printrange functionality?

The problem is: whatever I try allways all the pages are print (directly
to
the printer or via a preview control).

The VS-Build in help suggests checking the Printdocument.P rintPage event
during printing. And indeed I can check if the current page in the
Printpage
event should be printed or not. But HOW to cancel the current page, if the
page should not be printed, rather than the printjob? I don't want blanc
pages.

Regards Coen.


Jun 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4937
by: Steve Hanna | last post by:
I am having problems using the Printer Dialog to set PrinterSettings, specifically the landscape property of the DefaultPageSettings. Here's the code: <code> Private Sub GetPrinter(ByRef PrinterSettings as PrinterSettings, Landscape as Boolean) Dim pdiag As New PrintDialog Dim pset As New PrinterSettings pset.DefaultPageSettings.Landscape = Landscape
1
7760
by: Richard Golebiowski | last post by:
I have been trying to figure this out for quite some time and cannot find any examples in VB.Net or in VB that work correctly. I am working on an application where I want the user to be able to select a peinter and printer tray to print reports out. In Crystal Reports 8.5, I can select a printer and tray and it prints correctly. I did a test report that I use to tell me the value that Crystal Reports is using for the paper source. When I...
0
1555
by: trint | last post by:
try { // Wait for the report to completely render. if(m_numberOfPages < 1) return false; PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages; printerSettings.MinimumPage = 1; printerSettings.PrintRange = PrintRange.SomePages; printerSettings.FromPage = 1;
1
5709
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out of a Microsoft book, "Visual Basic,Net Step by Step" in Chapter 18. All but the bottom two subroutines will open a text file, and then allow me to use the above controls, example 1. The bottom two subroutines will print a graphic file, example...
0
1637
by: ShaneO | last post by:
There have been similar questions raised in the past, however no answers seem to have been provided, so I thought I'd give it a go. Scenario 1: My Windows Forms app generates (say) 10 pages in a Print Preview Control. These pages are made up of varying sized graphics and text, therefore each page is unique but does rely on the content of the previous page to determine the final page layout. My User wants to print ALL pages, pages 1 &...
2
6620
by: bp | last post by:
Hi, I try to use my own PreviewDialog with a PrinPreviewControl, to preview a document of type MyPrintDocument, and I want to implement the PrintRange functionnality (print some pages between 2 values). I noticed that we can specified the PrintRange, FromPage and ToPage properties of the PrintDocument.PrintSettings object, but, as said in MSDN : "The FromPage, ToPage and PrintRange can also be set programmatically,
2
6220
by: Tessa | last post by:
Hi, We have a .net web application, and are trying to use PrinterSettings.InstalledPrinters to list the printers installed on the webserver. (Windows 2003 server R2, IIS 6, .net framework 2.0.) The printers installed on the web server under the account used by asp.net for this web application are network printers that are shared by other computers that are on our domain. Permission has been granted for everyone to print to them. The...
0
1081
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
We are sending SRS reports directly to the printer from a WinForms application (using PrinterSettings() and PrintDocument() ). Everything works great except that we can't find a way to get to the "Flip Pages Up" property in the printer (This property sets two-sided to print so that pages can be flipped like a notebook). Can anyone tell me how to get to this printer property programmatically? Thanks,
2
5434
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
I’m not sure how to feed PCL commands (i.e. “Ec&l1S”) thru the PrinterSettings() function, but we have been successfully using the PrinterSetting() properties and methods to successfully call on most of the printer’s properties. Our understanding was that by using the correct combination of “.Landscape” and “.Duplex.Horizontal” properties, we would be able to accomplish the “flip pages up”, in which the report is...
0
8675
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7729
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6521
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.