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

papersize or paperbin

I am trying to print to a QMS 2060 printer on 11X17 paper in the upper paper
tray. I have tried to bring up the Printer Dialog box and modify the paper
bin and paper size but although I can modify the settings my report keeps
printing on letter size. If I try the "printer.papersize = " command I
receive a run-time error '380', Invalid property value. I have tried using
"3" and "258" as the values.

Paperbin property has the same result.

Can anyone offer any advice? Thanks in advance!
Jul 17 '05 #1
4 12792
What type of report is it? Active or Crystal report?

If so then you need to open your reports in their respective programs and
change their paper sizes there, then save it again...
--
Stéphane Richard
"Ada World" Webmaster
http://www.adaworld.com
"Chris Ott" <ch***@dalb.com> wrote in message
news:KX****************@news01.roc.ny...
I am trying to print to a QMS 2060 printer on 11X17 paper in the upper paper tray. I have tried to bring up the Printer Dialog box and modify the paper bin and paper size but although I can modify the settings my report keeps
printing on letter size. If I try the "printer.papersize = " command I
receive a run-time error '380', Invalid property value. I have tried using "3" and "258" as the values.

Paperbin property has the same result.

Can anyone offer any advice? Thanks in advance!

Jul 17 '05 #2
I am importing data from a flat file, performing many calculations then
printing the information directly to a network printer. I am using Visual
Basic ver 6 for this.

Thanks
Jul 17 '05 #3
On Thu, 25 Sep 2003 16:35:10 GMT, "Chris Ott" <ch***@dalb.com> wrote:
I am importing data from a flat file, performing many calculations then
printing the information directly to a network printer. I am using Visual
Basic ver 6 for this.


Ah, someone who uses Printer.Print !

It may be that the driver is not recognizing the change of paper size
- especially if it *knows* what paper is loaded in its bin

Try reading back the Papersize

Also messing with the height property

Printers are notorious for not 'understanding' a command until one has
done a dummy Printer.Print

ahem - except for setting Landscape / Portrait where that can throw an
error

I suggest that (for now) you rip the printer off the network- and test
it directly
Jul 17 '05 #4
Maybe you should try using API, ie. the DEVMODE structure and
DocumentProperties, DeviceCapabilities etc

Some years ago I had a written quite a few lines of code about printing.

For starters, here's a sub that returns all papersizes and their
corresponding long id of a printer:

Private Declare Function DeviceCapabilities Lib "winspool.drv" _
Alias "DeviceCapabilitiesA" (ByVal lpDeviceName As String, _
ByVal lpPort As String, ByVal iIndex As Long, ByVal lpOutput As String,
_
ByVal lpDevMode As Long) As Long

Private Declare Function DeviceCapabilities2 Lib "winspool.drv" _
Alias "DeviceCapabilitiesA" (ByVal lpDeviceName As String, _
ByVal lpPort As String, ByVal iIndex As Long, ptOutput As Any, _
ByVal lpDevMode As Long) As Long

Private Const DC_FIELDS = 1
Private Const DC_PAPERS = 2
Private Const DC_PAPERSIZE = 3
Private Const DC_MINEXTENT = 4
Private Const DC_MAXEXTENT = 5
Private Const DC_BINS = 6
Private Const DC_DUPLEX = 7
Private Const DC_SIZE = 8
Private Const DC_EXTRA = 9
Private Const DC_VERSION = 10
Private Const DC_DRIVER = 11
Private Const DC_BINNAMES = 12
Private Const DC_ENUMRESOLUTIONS = 13
Private Const DC_FILEDEPENDENCIES = 14
Private Const DC_TRUETYPE = 15
Private Const DC_PAPERNAMES = 16
Private Const DC_ORIENTATION = 17
Private Const DC_COPIES = 18
Private Const DCTT_BITMYD = &H1&
Private Const DCTT_DOWNLOAD = &H2&
Private Const DCTT_SUBDEV = &H4&
Private Declare Function OpenPrinter Lib "winspool.drv" Alias _
"OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
ByVal pDefault As Long) As Long

Private Declare Function DocumentProperties Lib "winspool.drv" _
Alias "DocumentPropertiesA" (ByVal hwnd As Long, _
ByVal hPrinter As Long, ByVal pDeviceName As String, _
pDevModeOutput As Any, pDevModeInput As Any, ByVal fMode As Long) _
As Long

Private Declare Function ClosePrinter Lib "winspool.drv" _
(ByVal hPrinter As Long) As Long

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" _
(ByVal lpDriverName As String, ByVal lpDeviceName As String, _
ByVal lpOutput As Long, ByVal lpInitData As Long) As Long



Public Function GetPrinterPaperSizes(ByRef gPaperSize() As Long, _
ByRef sPaperSize() As String, _
ByRef gPaperSizeCounter As Long) As Long
On Error GoTo Er

Dim PaperCount As Long
Dim PaperName As String
Dim sA As String
Dim tName As String
Dim iA As Long
Dim dl As Long
Dim gArray() As Integer

'initialise with failure
GetPrinterPaperSizes = 0

'is there a printer set?
If mhDCPrinter = 0 Then Exit Function

'find out how many paper names there are
PaperCount = DeviceCapabilities(mPrinterDeviceName, _
mPrinterPort, DC_PAPERNAMES, vbNullString, 0&)

'error
If PaperCount <= 0 Then Exit Function

'now dimension the string large enough to hold them all
PaperName = String$(64 * PaperCount, 0)

'get 'em
dl = DeviceCapabilities(mPrinterDeviceName, mPrinterPort, _
DC_PAPERNAMES, PaperName, 0)

If dl = -1 Then Exit Function

'ok
ReDim sPaperSize(1 To PaperCount) As String

'load the results
For iA = 1 To PaperCount
tName = Mid$(PaperName, (iA - 1) * 64 + 1)
sPaperSize(iA) = StripNulls(tName)
Next iA

'find out how many paper names there are, using the default DevMode
dl = 0
dl = DeviceCapabilities(mPrinterDeviceName, _
mPrinterPort, DC_PAPERS, vbNullString, 0&)

If dl <= 0 Or dl <> PaperCount Then Exit Function

ReDim gArray(1 To dl) As Integer

dl = DeviceCapabilities2(mPrinterDeviceName, _
mPrinterPort, DC_PAPERS, gArray(1), 0&)

If dl <= 0 Then Exit Function

ReDim gPaperSize(1 To PaperCount) As Long

For iA = 1 To PaperCount
gPaperSize(iA) = gArray(iA)
Next iA

gPaperSizeCounter = PaperCount

GetPrinterPaperSizes = 1

Er:
End Function
Also...
Private Function CreatePrinterDC(sPrinterName As String) As Long
On Error GoTo Er

Dim X As Printer
Dim dl As Long

CreatePrinterDC = 0

If mhDCPrinter <> 0 Then dl = DeleteDC(mhDCPrinter)

For Each X In Printers
If X.DeviceName = sPrinterName Then
mhDCPrinter = CreateDC(X.DriverName, X.DeviceName, 0&, 0&)
If mhDCPrinter <> 0 Then
'success
CreatePrinterDC = 1
'store these values
mPrinterDeviceName = X.DeviceName
mPrinterDriverName = X.DriverName
mPrinterPort = X.Port
'get DEVMODE
GetDEVMODE '<<< ignore this
'load data
LoadPrinterData '<<< ignore this
End If
Exit Function
End If
Next X

Er:
End Function
And...

Private Function StripNulls(OriginalStr As String) As String
On Error Resume Next
If (InStr(OriginalStr, Chr$(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr$(0)) - 1)
End If
StripNulls = Trim$(OriginalStr)
End Function


This should get you started - it's been a long time since I left these
projects, anyway!

Cheers
A.

"Chris Ott" <ch***@dalb.com> wrote in message
news:2P***********@news01.roc.ny...
I am importing data from a flat file, performing many calculations then
printing the information directly to a network printer. I am using Visual
Basic ver 6 for this.

Thanks

Jul 17 '05 #5

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

Similar topics

0
by: Pedro Feio | last post by:
Hi, I'm having a weird problem setting up the paper size in a C# Windows Forms Application. The code I'm using is something like this: PrintDocument pd = new PrintDocument(); ...
0
by: Raul | last post by:
I need to define a papersize 8.5'', 15'. I define it using propertysettings and papersize collection in C# but the printer don't print when the datas is below to 11''. My printer is HP Laserjet...
0
by: epederiva | last post by:
Hi, I have a problem with a laser feed tractor printer, paper size is 8.3 X 11 inc.. For print in windows xp home from a c# application i use a custom paper size added at the printer server...
4
by: °Ë´óɽÈË | last post by:
There is a PaperSize class in .net framework. But it has only one constructor: public PaperSize(string name,int width,int height); I want to create a object whose kind isn't "Customer". How shall I...
1
by: JuanCarlos Gomez | last post by:
I am try to customize papersize on VBNET (PrintDialog, PritnDocument), but only have access to defined Paper Size on my Printer (FX-2180), how I can customize papersize and use it. Because all the...
1
by: bafidi | last post by:
i want to write a code and make the papersize A but this code is wrong what is the true on PrintDocument1.DefaultPageSettings.papersize=A4
0
by: Madern | last post by:
Good Morning, I'm developing a code that needs to deal with different printer user formats which have to be created on a network driver printer (OKI 321). The big issue I am finding is that the...
0
by: Madern | last post by:
Good Morning, I'm developing a code that needs to deal with different printer user formats which have to be created on a network driver printer (OKI 321). The big issue I am finding is that the...
0
by: Amir Alilou | last post by:
hi I want to change the size of paper prorammatically in my code. but when i do it my printer paper size do not change. please help me with sample.(VB.NET 2003) Public Sub Print_It() Try Try...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...

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.