473,856 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PRINTING and changing paper size

No matter what I do the default paper size is always either A3 or 11 by 8.5
..

Here is the code.

Dim dlg As DialogResult

pd.DocumentName = "Weld Image"

Dim pkPaperSize As New Printing.PaperS ize("sdfgsfdg", 850, 1100)

pd.DefaultPageS ettings.PaperSi ze = pkPaperSize

prnt.Document = pd

prnt.AllowSomeP ages = False

prnt.AllowSelec tion = False

prnt.PrintToFil e = False

prnt.PrinterSet tings.DefaultPa geSettings.Pape rSize = pkPaperSize

dlg = prnt.ShowDialog ()

If dlg = DialogResult.OK Then

pd.PrinterSetti ngs = prnt.PrinterSet tings

pd.Print()

End If

In the OnPrint event I have also tried setting the correct paper size to get
this to go. Nothing works worth a shit.


Nov 21 '05 #1
3 31984
"D Witherspoon" <dw**********@n oway.org> schrieb:
No matter what I do the default paper size is always either A3 or 11 by
8.5


\\\
PrintDocument1. DefaultPageSett ings.PaperSize = _
New PaperSize("My Custom format", 100, 100)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Yeah, you would think that would work..

Should create a 1" by 1" page.

I've tried all of that.

I have changed the PaperSize on the PrintDocument.D efaultPageSetti ngs object,
the
PrintDocument.P rinterSettings. DefaultPageSett ings object

and the

e.PageSettings object in the PrintPage event.

none of this does anything. thats why I am getting frustrated. it defaults to A3... prints it, the printer asks you to instert A3 paper.

What am I doing wrong? Am I wasting my time... is this an impossible feat.... Here is all the code if you want to take a look and see if you can spot something...

Private Sub PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing. Printing.PrintP ageEventArgs) Handles pdImage.PrintPa ge

Dim pen As New System.Drawing. Pen(Color.Tan)

'Dim rect As New System.Drawing. Rectangle(25, 25, 750, 1050)

Dim img As Image = upbImage.Image

Dim largestRatio As Double = Math.Max(img.Wi dth / 700, img.Height / 780)

Dim mx As System.Drawing. Drawing2D.Matri x = New System.Drawing. Drawing2D.Matri x(1.0 / largestRatio, 0, 0, 1 / largestRatio, 0, 0)

Dim ps As New Printing.PaperS ize("paper", 100, 100)

e.PageSettings. PaperSize = ps

e.PageSettings. PaperSize.Heigh t = 100

e.PageSettings. PaperSize.Width = 100

e.PageSettings. Landscape = False

e.Graphics.Tran sform = mx

e.Graphics.Draw ImageUnscaled(i mg, 0, 25)

Dim rushes

' Create font and brush.

Dim drawFont As New Font("Arial", 10)

Dim drawBrush As New SolidBrush(Colo r.Black)

' Create point for upper-left corner of drawing.

'Dim x As Single = 20.0F

Dim y As Single = 20.0F

' Set format of string.

Dim drawFormat As New StringFormat

' drawFormat.Form atFlags = StringFormatFla gs.DirectionVer tica

e.Graphics.Draw String(CurrentA ssy.PartNo, drawFont, drawBrush, 40.0F, y, drawFormat)

e.Graphics.Draw String("Mod Note: " & CurrentAssy.Mod Note, drawFont, drawBrush, 275.0F, y, drawFormat)

e.Graphics.Draw String("Date Printed: " & Format(Now(), "MMM-dd-yyyy"), drawFont, drawBrush, 450.0F, y, drawFormat)

'e.PageSettings .PaperSize.Pape rName = "letter"

'e.PageSettings .PaperSize.Heig ht = 85

'e.PageSettings .PaperSize.Widt h = 110

'e.PageSettings .Landscape = False

'Dim i As Integer

'For i = 0 To e.PageSettings. PrinterSettings .PaperSizes.Cou nt - 1

'e.PageSettings .PrinterSetting s.PaperSizes.It em(i).Kind = Printing.PaperK ind.Letter

'If e.PageSettings. PrinterSettings .PaperSizes.Ite m(i).Kind =Printing.Paper Kind.Letter Then

' Exit For

'End If

'Next

End Sub

Private Sub utbImage_ToolCl ick(ByVal sender As Object, ByVal e As Infragistics.Wi n.UltraWinToolb ars.ToolClickEv entArgs) Handles utbImage.ToolCl ick

Dim pd As Printing.PrintD ocument

pd = pdImage

If upbImage.Image Is Nothing Then

MsgBox("No Image To Print", MsgBoxStyle.Exc lamation)

Exit Sub

End If

Select Case e.Tool.Key

Case "Preview"

pd.DocumentName = "Weld Image"

Dim pkPaperSize As New Printing.PaperS ize("fgsfdg", 100, 100)

pd.DefaultPageS ettings.PaperSi ze = pkPaperSize

upDlg.PrintPrev iewControl.Docu ment = pd

upDlg.TopMost = True

upDlg.ShowDialo g()

Case "Print"

Dim dlg As DialogResult

pd.DocumentName = "Weld Image"

Dim pkPaperSize As New Printing.PaperS ize("sdfgsfdg", 100, 100)

pd.DefaultPageS ettings.PaperSi ze = pkPaperSize

pd.DefaultPageS ettings.Landsca pe = False

pd.PrinterSetti ngs.DefaultPage Settings.Landsc ape = False

pd.PrinterSetti ngs.DefaultPage Settings.PaperS ize = pkPaperSize

prnt.Document = pd

prnt.AllowSomeP ages = False

prnt.AllowSelec tion = False

prnt.PrintToFil e = False



'prnt.PrinterSe ttings.DefaultP ageSettings.Pap erSize = pkPaperSize

'prnt.PrinterSe ttings.DefaultP ageSettings.Lan dscape = False

MsgBox(pd.Defau ltPageSettings. ToString)

dlg = prnt.ShowDialog ()

If dlg = DialogResult.OK Then

pd.PrinterSetti ngs = prnt.PrinterSet tings

pd.PrinterSetti ngs.DefaultPage Settings.Landsc ape = False

pd.PrinterSetti ngs.DefaultPage Settings.PaperS ize.Height = 850

pd.PrinterSetti ngs.DefaultPage Settings.PaperS ize.Width = 1100

pd.PrinterSetti ngs.DefaultPage Settings.Margin s.Left = 0

pd.PrinterSetti ngs.DefaultPage Settings.Margin s.Right = 0

pd.PrinterSetti ngs.DefaultPage Settings.Margin s.Top = 0

pd.PrinterSetti ngs.DefaultPage Settings.Margin s.Bottom = 0

pd.Print()

End If

End Select

End Sub

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
"D Witherspoon" <dw**********@n oway.org> schrieb:
No matter what I do the default paper size is always either A3 or 11 by
8.5


\\\
PrintDocument1. DefaultPageSett ings.PaperSize = _
New PaperSize("My Custom format", 100, 100)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
"D Witherspoon" <dw**********@n oway.org> schrieb:
Yeah, you would think that would work..

Should create a 1" by 1" page.

I've tried all of that.


Mhm... It works just fine on my machine. Maybe the problem is related to
the printer you are using.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

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

Similar topics

2
4782
by: Chris Bingham | last post by:
Hi everyone, Does anyone know how to fix the paper orientation depending on the paper size used when printing with the WebBrowser control please? What I've got is a HTML file, containing 1 big table of data, created by transforming an XML file using a XSLT file I created in InfoPath (didn't have time to learn XSLT!), the resulting HTML file is fine, except I had to fix the column sizes of the table in cm. Because of this, the table will...
7
2758
by: tm | last post by:
I am trying to print a form using the following code, everything works fine but the margins are not acted upon. What I am I doing wrong? Private Sub CaptureScreen() Dim myGraphics As Graphics = Me.CreateGraphics() Dim s As Size = Me.Size memoryImage = New Bitmap(s.Width, s.Height, myGraphics) Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
2
2549
by: Sukh | last post by:
Hi I am stuck with a problem Can anyone help me out from this... I am printing a report on pre-printed continue paper using dot-matrix printer using vb.net. Data is printing on all the locations. But After printing first page it increase paper 3cm vertically/Height so on second
9
2895
by: Sukh | last post by:
Hello anyone, I am printing a pre-printed continue paper on dot-matrix printer using vb.net winform. For printing I am creating custom size paper and selecting the same for printing. Everything is going fine on first page but after printing first page it feed some extra paper (3cm paper). So on 3rd page again 3cm mean total 6 cm extra...So its changing all the location where I have to print. Can anyone help me out from this?
6
12442
by: Brewtzaff | last post by:
Hello, I have a little problem to print my reports on custom sized paper. I got a db containing clubmembers, a query which selects only the needed infos to print out my membershipcards. My card is 79mm high and 210 mm large, and each card is on a paper with the same size, but I'm unable (don't know really how) to create a report to print out my cards as defined.
1
9953
by: Anne DeBlois | last post by:
Hi, I want to programatically set the paper size of a print document. I created a class that inherits PrintDocument, so I can print some database records on 8" x 10" paper. I added this line to my class constructor: Dim customPaperSize As New Printing.PaperSize("8x10", 800, 1000)
8
17752
by: Steve Macleod | last post by:
Hi, I was wondering if anyone had a solution for printing HTML elements (especially style elements). I do not wish to make any changes to the page, other than in the <css media="print"block. I can use: select { border:1px solid #FFFFFF; } to get rid of the border, but dont know a way to get rid of the arrow
2
9991
by: Brad Pears | last post by:
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...
9
7864
by: Gurbinder Kaur | last post by:
Hi, i have made a project for printing fee receipt. Using Windows-XP, VBasic 6.0 & Ms-Access-97. i have designed a form for prinring receipts. m paper-size is 5x10. Two copies of bills in this size. one for student and other for fee clerk. while printing on dot-matrix, form get printed, but size is A4. My problem is * how to change size to 5x10 (exactly half of printed paper width-wise) * after printing on this size, stop the printer and...
0
9916
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9762
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
10782
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
9531
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, and deployment—without 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
7932
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
7094
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();...
0
5958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4174
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3201
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.