OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-10-2003, 11:42
narcix
Guest
 
Posts: n/a
Default Printer page size and orientation from VBA

Can I change printer's paper size and orientation from Corel VBA?

Thank you
Reply With Quote
  #2  
Old 01-10-2003, 14:53
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: Printer page size and orientation from VBA

Quote:
Originally Posted by narcix
Can I change printer's paper size and orientation from Corel VBA?
No.
Reply With Quote
  #3  
Old 07-10-2003, 19:24
donphillipe
Guest
 
Posts: n/a
Default

Is there any way around this? i.e. is there a way to change what the default settings are for a driver to make them that way permanently? Or can you zap some storage location?
Reply With Quote
  #4  
Old 07-10-2003, 20:38
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

Quote:
Originally Posted by donphillipe
Is there any way around this? i.e. is there a way to change what the default settings are for a driver to make them that way permanently? Or can you zap some storage location?
I haven't checked but maybe a saved print style would contain that information (but I doubt). Another possible solution would be to change the setting in the default printer driver. Then restart Draw. I don't see any other way of doing it. The problem is that CorelDRAW as many other application "clones" the printer driver settings at startup and keeps them around until you shut down. So changing these settings won't affect the global printer settings and those of other applications running on the system. This is a good thing but a downside of this is that you can't get into these settings "from outside". The only way is to shut down the application, change the global settings, re-launch Draw so it can read in the updated parameters.
Reply With Quote
  #5  
Old 07-10-2003, 23:39
donphillipe
Guest
 
Posts: n/a
Default

I am no Win32 API guru, but does this page have any helpful info? It shows how to change to duplex from a word document print routine:

http://support.microsoft.com/default...=vbb#appliesto

I am looking to change the tray to Tray 1 and paper thinkness to Cardstock (?dmMedia) via the DEVMODE API. If anyone figures it out, let me know! Thanks

P.S. I know this is VB but it does look like they create a Word object prior to changing the settings, so maybe it could be used for Corel as well (e.g. since they appear to change the settings after object created, maybe this call will work while the app is active???).
Reply With Quote
  #6  
Old 07-10-2003, 23:58
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

Feel free to try that however I'm thinking it won't work. Try this:

1. Go to Printers folder in windows and change a setting in your default printer (e.g. the page size)
2. Start CorelDRAW and create a new document, add some object to the page
3. Go to File>Print and check the settings of the printer (page size). It should be what you have set up in Windows.
4. Now with Draw still running go back to Windows and change the page size to something else.
5. Return to Draw and check the printer page now. I'm pretty sure it will be the old size. That's because CorelDRAW keeps a copy of all print settings for the printer while it is running so changing the printer settings (either through Control Panel or programmaically by opening a printer and changing some data) won't affect the data used by CorelDRAW.

But I would be glad if I'm wrong on this because I like many others would surely want to have this ability to change printer settings from VBA.
Reply With Quote
  #7  
Old 17-10-2003, 10:21
bbolte
Guest
 
Posts: n/a
Default

i have been working on this myself (off and on for quite a while) and had come to the same conclusion as Alex. Corel won't get the new size when it's changed if corel is open. I have yet to come up with anything viable myself but I had 2 thoughts that brought me here this morning.

1) can a gms module or something be programmed to make this change from within corel or will the same as above apply? i don't thinks so but wondering what people thought here.

2) my other thought is very convoluted but might work. alex basically said the same thing above, just didn't think of re-opening corel. here goes a brief explanation.

i need to set the page size to 1 of 2 options depending on what's on my document. the settings for the pages are custom setting, which doesn't make it any easier, as i can't use the vb printer objects properties and have to go with api. so here is my thought.

after corel completes the graphic(s), i get the appropriate dimensions needed to define the custom paper size that i need and save to some variable. i then convert the corel doc to an adobe acrobat file. acrobat can be controlled through vb, much like corel. set the appropriate page size, open the pdf in acrobat and print. now the question, why do the intermediate pdf step when the doc could just be re-opened in corel as alex stated above?

i haven't come up with any other options and i have looked, searched and asked questions everywhere.
Reply With Quote
  #8  
Old 17-10-2003, 11:41
bbolte
Guest
 
Posts: n/a
Default

after brainstorming this morning further with the other developer here (and a thanks for alex for clarifying what corel was or wasn't doing), this is the route that i'm going to pursue here.

i will know what paper size i will need before i open corel by a couple of parameters that will be used to build the graphics. by checking this parameter before i open corel, i can determine what printer/paper size i need and change it then. then open corel, build graphics, print, close corel and change the printer back to what it was before.

i'm thinking about actually setting up a couple of printers, using the same printer but setting different default paper sizes for them. then all i have to do is change the printer from within vb before i start corel.

thanks everyone for giving me some ideas.
Reply With Quote
  #9  
Old 17-10-2003, 14:38
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default The problem will be solved soon

I just got some good news that printer page size will be directly exposed through object model in Draw 12:

Class PrintSettings
Properties:
  • ...
  • Property PageSet As PrnPageSet
  • Property PaperHeight As Double
  • Property PaperOrientation As PrnPaperOrientation
  • Property PaperSize As PrnPaperSize
  • Property PaperWidth As Double
  • ...
Methods:
  • ...
  • Sub SelectPrinter(ByVal Name As String)
  • Sub SetCustomPaperSize(ByVal Width As Double, ByVal Height As Double, ByVal Orientation As PrnPaperOrientation)
  • Sub SetPaperSize(ByVal PaperSize As PrnPaperSize, ByVal Orientation As PrnPaperOrientation)
  • ...

Sounds promising!
Reply With Quote
  #10  
Old 17-10-2003, 14:54
bbolte
Guest
 
Posts: n/a
Default Re: The problem will be solved soon

Quote:
Originally Posted by Alex
I just got some good news that printer page size will be directly exposed through object model in Draw 12...
woo hoo!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump


All times are GMT -5. The time now is 02:12.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com