473,401 Members | 2,068 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,401 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 1126

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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
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...

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.