473,379 Members | 1,511 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,379 software developers and data experts.

Printed document being cropped - please help


I have an application that is supposed to print a badge using a Dymo
LabelWriter 330. The problem I am having is this - when I 'Print Preview'
the badge, it is displayed properly, but when I 'Print' the badge, it is
cropped.

Let me show a code snippet and some debugging data:

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPrint.Click
printerSetup()
prtDocBadge.Print()
End Sub

Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPreview.Click
printerSetup()
Dim dlg As New PrintPreviewDialog
dlg.Document = prtDocBadge
dlg.Show()
End Sub

Private Sub printerSetup()
prtDocBadge.PrinterSettings.PrinterName = "DYMO LabelWriter 330-USB"

' Get the index for the desired paper type. Actual size is 2 5/16" x 4"
Dim i As Integer
For i = 0 To prtDocBadge.PrinterSettings.PaperSizes.Count - 1
If (prtDocBadge.PrinterSettings.PaperSizes(i).PaperNa me = "30256
Shipping") Then
Exit For
End If
Next

prtDocBadge.DefaultPageSettings.Margins.Bottom = 0
prtDocBadge.DefaultPageSettings.Margins.Left = 0
prtDocBadge.DefaultPageSettings.Margins.Top = 0
prtDocBadge.DefaultPageSettings.Margins.Right = 0
prtDocBadge.DefaultPageSettings.PaperSize =
prtDocBadge.PrinterSettings.PaperSizes(i)
End Sub

Private Sub prtDocBadge_PrintPage(ByVal sender As System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles prtDocBadge.PrintPage
Dim bLeft, bRight, bTop, bBottom As Single
Dim hdc As IntPtr = e.Graphics.GetHdc
GetHardMargins(hdc, bLeft, bRight, bTop, bBottom) ' for debugging only
e.Graphics.ReleaseHdc(hdc) ' break point at next line in code
End Sub

When I examine the data at the break point

For 'Print Preview': Left Right Top Bottom
Width Height
e.Graphics.ClipBounds -1398101.38 1398101.38 -1398101.38
1398101.38 2796202.75 2796202.75
e.Graphics.VisibleClipBounds -1398101.38 1398101.38 -1398101.38
1398101.38 2796202.75 2796202.75
e.MarginBounds 0 231 0 400
231 400
e.PageBounds 0 231 0 400
231 400
hard margins 0 0 90.5 157.5

For 'Print': Left Right Top Bottom
Width Height
e.Graphics.ClipBounds -1398101.38 1398101.38 -1398101.38
1398101.38 2796202.75 2796202.75
e.Graphics.VisibleClipBounds 0 91 0 157.3
91 157.3
e.MarginBounds 0 231 0 400
231 400
e.PageBounds 0 231 0 400
231 400
hard margins 0 0 90.5 157.5

The underlying problem seems to be that the printer's 'hard margin' is not
properly set. For the 'Print' case, this seems to manifest itself as a
limitation on VisibleClipBounds which causes the document to be cropped when
it gets printed.

Would you please suggest a solution to this problem.
Thank you!.

--
Gerry Roston
Pair of Docs Consulting
ge***@pairofdocs.net
Nov 21 '05 #1
0 1123

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

Similar topics

0
by: Matt Brelje | last post by:
I have an .aspx page from which users can upload an image. After a file is uploaded, I also save a 60x60 pixel thumbnail of that image. Works great. What I can't seem to do is save a CROPPED...
0
by: .NETuser | last post by:
can any body help me with this? I need to send attachments using using System.Web.Mail namespace. problem is that my attachments are being cropped no matter what the original size is, for exmaple...
0
by: Kevin Smith | last post by:
I have a need to align the baseline of some text with the baseline of text within an image as in the following snippet. <html> <body> Inside table, image is cropped. <table border="1"><tr><td>...
10
by: RobinS | last post by:
Hello to all, and happy new year! I have this application that someone wrote that I'm sort of checking out. The forms look fine in design mode, but when I run the application, it crops off the...
2
by: nick | last post by:
Is it possible to use the print css (in css2) to make sure that a small image is printed on the top right corner (with background- position) of each printed page of the same document? Thanks.
8
by: Zytan | last post by:
I am getting a Debug.Assert() firing which shows a mesasge so large that it is cropped. But it crops off the beginning. So, I have no idea what assertion is. My code is not complex. It's just...
4
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am not a person usually works with image file. I am just wondering while some images in html /asp cannot be printed out? Thank you. -- Betty
3
by: Kristijan Marin | last post by:
Hi, I need to print a report like document. So in report there are many articles and what I need when I get to the end, is to update page numbers on the second page where the Table of Content...
0
by: ravishankar Maduri | last post by:
Hi Freinds if any one knows how to disable the dragging of images to the address bar In my project i implemented the dragging feature by using the cropped images, its working finebut when we...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.