472,811 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,811 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 12767
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...
--
Stphane 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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.