PC Review


Reply
Thread Tools Rate Thread

Check available pagesize

 
 
=?Utf-8?B?R2VyYXJkVg==?=
Guest
Posts: n/a
 
      21st Apr 2007
Is it possible to check if a printer (on the network) can handle a certain
page size, for instants A2 size???
I've solved it for now by error handling during setting of page size, by
asking to select an other printer. Problem is that when a second printer is
chosen that also doesn't support A2 paper size the macro stops on error......

Suggestions anyone???



--
-----------------------------

 
Reply With Quote
 
 
 
 
Norman Jones
Guest
Posts: n/a
 
      22nd Apr 2007
Hi Gerard,

'------------------
Is it possible to check if a printer (on the network) can handle a certain
page size, for instants A2 size???
I've solved it for now by error handling during setting of page size, by
asking to select an other printer. Problem is that when a second printer is
chosen that also doesn't support A2 paper size the macro stops on
error......
'------------------

See the MSDN Article:

Retrieving Printer Capabilities
http://tinyurl.com/4khvy


---
Regards,
Norman


 
Reply With Quote
 
=?Utf-8?B?dXJrZWM=?=
Guest
Posts: n/a
 
      22nd Apr 2007
I think you can use this:



Sub PrinterPaperSizes()

Computer = "."
Set WMISrv = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& Computer & "\root\cimv2")

Set Printers = WMISrv.ExecQuery _
("Select * from Win32_Printer ")

For Each Printer In Printers
For Each pn In Printer.PrinterPaperNames
Debug.Print Printer.Name & " supports " & pn
Next
Next

End Sub


It should return available paper sizes for all printers .

If you want the information just for one printer you need to specify the
printer name:

Set Printers = WMISrv.ExecQuery _
("Select * from Win32_Printer " & _
"Where Name = 'HP LJet 1020'")

You could use Printer.PaperSizesSupported instead of
Printer.PrinterPaperNames, but then you would have to map paper sizes to ints
( A2 = 20 ...)

For Each ps In Printer.PaperSizesSupported
Debug.Print Printer.Name & " supports " & ps
Next


Hope this helps some.

--
urkec


"GerardV" wrote:

> Is it possible to check if a printer (on the network) can handle a certain
> page size, for instants A2 size???
> I've solved it for now by error handling during setting of page size, by
> asking to select an other printer. Problem is that when a second printer is
> chosen that also doesn't support A2 paper size the macro stops on error......
>
> Suggestions anyone???
>
>
>
> --
> -----------------------------
>

 
Reply With Quote
 
=?Utf-8?B?R2VyYXJkVg==?=
Guest
Posts: n/a
 
      22nd Apr 2007
Norman and ukec,
Thanks for the info it's both very useful.

Greetings and many thanks
Gerard
--
-----------------------------



"urkec" wrote:

> I think you can use this:
>
>
>
> Sub PrinterPaperSizes()
>
> Computer = "."
> Set WMISrv = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" _
> & Computer & "\root\cimv2")
>
> Set Printers = WMISrv.ExecQuery _
> ("Select * from Win32_Printer ")
>
> For Each Printer In Printers
> For Each pn In Printer.PrinterPaperNames
> Debug.Print Printer.Name & " supports " & pn
> Next
> Next
>
> End Sub
>
>
> It should return available paper sizes for all printers .
>
> If you want the information just for one printer you need to specify the
> printer name:
>
> Set Printers = WMISrv.ExecQuery _
> ("Select * from Win32_Printer " & _
> "Where Name = 'HP LJet 1020'")
>
> You could use Printer.PaperSizesSupported instead of
> Printer.PrinterPaperNames, but then you would have to map paper sizes to ints
> ( A2 = 20 ...)
>
> For Each ps In Printer.PaperSizesSupported
> Debug.Print Printer.Name & " supports " & ps
> Next
>
>
> Hope this helps some.
>
> --
> urkec
>
>
> "GerardV" wrote:
>
> > Is it possible to check if a printer (on the network) can handle a certain
> > page size, for instants A2 size???
> > I've solved it for now by error handling during setting of page size, by
> > asking to select an other printer. Problem is that when a second printer is
> > chosen that also doesn't support A2 paper size the macro stops on error......
> >
> > Suggestions anyone???
> >
> >
> >
> > --
> > -----------------------------
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pagesize Mike Givens Windows Vista General Discussion 3 12th Nov 2009 07:36 PM
when I check PageSize im mPD the custom size is not there active Microsoft VB .NET 0 9th Apr 2007 10:54 PM
Pagesize =?Utf-8?B?R3JhaGFtIENvcmZpZWxk?= Microsoft Frontpage 2 7th Apr 2006 10:55 AM
PageSize in a PageSetupDialog ?? cmrchs@yahoo.com Microsoft Dot NET Framework Forms 1 27th May 2004 12:48 PM
Reading pdf pagesize Niels Microsoft VB .NET 2 19th Apr 2004 12:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:42 PM.