473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Printing from the print preview screen

I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default printer settings to print.

I wanted the print preview to appear the same for all users (i.e. a default page size of 8.5x14 (legal) and portrait mode). Many users have different printers as their default (plotters etc..) and I found that various users were having problems viewing the entire drawing - depending on the selected default printer.

So, to accomplish this I used the below commands to set a custom paper size and set landscape off before viewing the print preview dialog...

It works just fine for viewing but when the user clicks the printer icon, the print job appears to be displaying only a small part of the drawing as if it has zoomed way in. There is simply a soliod thick black line - which appears to possibly be a part of the drawing. After some quick testing - I determined that the line of code causing this problem is the line where I am setting the custom page size. if I comment this line out, it is fine - except I am back to the old problem of users viewing the drawing based on their currently selected printer - which may cause a screw up with the viewing...

Does anyone have any ideas on this one??

Thanks, Brad
------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Set default paper size to legal size using a custom form (length/width dimensions are in 1000's of an inch)

dlgPrintPreview.Document.DefaultPageSettings.Paper Size = New Printing.PaperSize("Custom", 8500, 14000)

' Ensure portrait printing by setting landscape as false

dlgPrintPreview.Document.DefaultPageSettings.Lands cape = False

' Show it!

dlgPrintPreview.ShowDialog()

-----------------------------------------------------------------------------------------------------
Jun 7 '07 #1
2 9911
Hi Brad,

Not sure if you are already using it, but I got around printing issues by
using the Report Item (which you get from the Project Menu/Add New Item - the
select the Report Item from the list of items - same list that contains
Forms, Icons...). This will create an RDLC Item (very similar to a Reporting
Services RDL file). Note: this is not the Report control from the toolbox -
although the Report control uses an RDLC (I think if you select the Report
control from the toolbox - it automatically creates an RDLC Item).

In the RDLC you set up your Layout that you want to print out. I have had
pretty good luck with this so far. I also found that the RDLC file will work
better if you create a persistent table in your project (not a table created
on the fly). I create a persistent dataset in the dataSources tab but I
don't select any tables from the server. Then I add my own table (my
persistent table) to the Design view of the dataset in the DataSources tab.
Then when you add controls to the RDLC - textboxes, tables,... you bind the
table fields to the controls by dragging the table field from your persistent
table to the desired control. Then just populate that table as you need, the
same way you populate any table in a dataset.

HTH
Rich
"Brad Pears" wrote:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default printer settings to print.

I wanted the print preview to appear the same for all users (i.e. a default page size of 8.5x14 (legal) and portrait mode). Many users have different printers as their default (plotters etc..) and I found that various users were having problems viewing the entire drawing - depending on the selected default printer.

So, to accomplish this I used the below commands to set a custom paper size and set landscape off before viewing the print preview dialog...

It works just fine for viewing but when the user clicks the printer icon, the print job appears to be displaying only a small part of the drawing as if it has zoomed way in. There is simply a soliod thick black line - which appears to possibly be a part of the drawing. After some quick testing - I determined that the line of code causing this problem is the line where I am setting the custom page size. if I comment this line out, it is fine - except I am back to the old problem of users viewing the drawing based on their currently selected printer - which may cause a screw up with the viewing...

Does anyone have any ideas on this one??

Thanks, Brad
------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Set default paper size to legal size using a custom form (length/width dimensions are in 1000's of an inch)

dlgPrintPreview.Document.DefaultPageSettings.Paper Size = New Printing.PaperSize("Custom", 8500, 14000)

' Ensure portrait printing by setting landscape as false

dlgPrintPreview.Document.DefaultPageSettings.Lands cape = False

' Show it!

dlgPrintPreview.ShowDialog()

-----------------------------------------------------------------------------------------------------

Jun 7 '07 #2
Unfortuantely I still have not got my particular issue resolved. For now I
have commented out the line causing the issue and am having the users live
with a possible screwed up print preview for now...

Thanks for the information though. I have not used a report item before.
This particular print job is printing a drawing (actually a .jpg) from a
"byte-array" field that is coming from an SQL Server db table. It's a
non-standard type of report because I am simply passing the byte array over
to the print job and then producing the print from there. I am not really
filling any data tables to do it...

I will definately print your info and give it a shot the next time I am
producing a report!

Thanks, Brad
"Rich" <Ri**@discussions.microsoft.comwrote in message
news:DB**********************************@microsof t.com...
Hi Brad,

Not sure if you are already using it, but I got around printing issues by
using the Report Item (which you get from the Project Menu/Add New Item -
the
select the Report Item from the list of items - same list that contains
Forms, Icons...). This will create an RDLC Item (very similar to a
Reporting
Services RDL file). Note: this is not the Report control from the
toolbox -
although the Report control uses an RDLC (I think if you select the Report
control from the toolbox - it automatically creates an RDLC Item).

In the RDLC you set up your Layout that you want to print out. I have
had
pretty good luck with this so far. I also found that the RDLC file will
work
better if you create a persistent table in your project (not a table
created
on the fly). I create a persistent dataset in the dataSources tab but I
don't select any tables from the server. Then I add my own table (my
persistent table) to the Design view of the dataset in the DataSources
tab.
Then when you add controls to the RDLC - textboxes, tables,... you bind
the
table fields to the controls by dragging the table field from your
persistent
table to the desired control. Then just populate that table as you need,
the
same way you populate any table in a dataset.

HTH
Rich
"Brad Pears" wrote:
>I have a vb.net 2005 application and am using the print preview screen.
This screen has a printer icon on it that the user can use to print the
document currently being viewed. It uses the default printer settings to
print.

I wanted the print preview to appear the same for all users (i.e. a
default page size of 8.5x14 (legal) and portrait mode). Many users have
different printers as their default (plotters etc..) and I found that
various users were having problems viewing the entire drawing - depending
on the selected default printer.

So, to accomplish this I used the below commands to set a custom paper
size and set landscape off before viewing the print preview dialog...

It works just fine for viewing but when the user clicks the printer icon,
the print job appears to be displaying only a small part of the drawing
as if it has zoomed way in. There is simply a soliod thick black line -
which appears to possibly be a part of the drawing. After some quick
testing - I determined that the line of code causing this problem is the
line where I am setting the custom page size. if I comment this line out,
it is fine - except I am back to the old problem of users viewing the
drawing based on their currently selected printer - which may cause a
screw up with the viewing...

Does anyone have any ideas on this one??

Thanks, Brad
------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Set default paper size to legal size using a custom form (length/width
dimensions are in 1000's of an inch)

dlgPrintPreview.Document.DefaultPageSettings.Pape rSize = New
Printing.PaperSize("Custom", 8500, 14000)

' Ensure portrait printing by setting landscape as false

dlgPrintPreview.Document.DefaultPageSettings.Land scape = False

' Show it!

dlgPrintPreview.ShowDialog()

-----------------------------------------------------------------------------------------------------


Jun 12 '07 #3

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

Similar topics

3
by: Fabio Pliger | last post by:
Hi! I'm using wxPython to handle my application gui.. So, I have a notebook widget and i have to print the object inside it's tab ... Maybe doing a preview before printing... I know that wx has...
6
by: Snuffy Smith | last post by:
I'm using css for page layout and a table for tabular data on an asp page. all displays correctly on the monitor, but when printed all pages after the first page are blank. this occurs in preview...
6
by: Roger Shrubber | last post by:
I know HTML was never designed to be WYSIWYG, but with CSS, there is much greater control over coordinates and dimensions. So I would expect that a specific piece of text, with a specific font,...
16
by: Neo Geshel | last post by:
I'm helping on a web site, and it's got our knickers in a knot. We're using the same basic CSS files (with mods) and same headers as from our other sites, but the "print preview" won't work...
8
by: Tinus | last post by:
Hello all, Because you have been so helpfull the last couple of times, I thought after testing and wasting more than 20 pages (and google-ling for 3 days :-( ). I would ask you again for your...
1
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...
2
by: Shmuel Shulman | last post by:
Hi I set the printing paper to A4 and on my preview screen it seems fine but on the preview screen of the others it doesn't look the same Also once it is sent to the printer it doesn't print the...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
2
by: JF | last post by:
Hello, I have a problem with a print.css. When trying to print or using the print preview in Firefox only a blank page is shown. At http://80.190.188.58/test/test.html you can find a test-page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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 project—planning, coding, testing,...

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.