473,473 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 9925
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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...

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.