Posts: 14
Registered: ‎02-22-2012
Message 1 of 2 (475 Views)

How to change plot device but leave default paper size (media name)?

475 Views, 1 Replies
04-03-2012 02:06 PM

Now I'm going to write a code that will change current plot device of the drawing and there isn't a problem here:

acPlSetVdr.SetPlotConfigurationName(acPlSet, newPrinter, "A4");

But how can I leave default paper size not "A4"? For example if there is "A3" it should stay "A3". Because if I go through each drawing I don't know what is the current paper size I just need to change the plot device becuse default has been crashed for example. But if I write "A4" each drawing will have "A4". 


Hope I explain everything clearly. Thanx for suggestions.

Posts: 174
Registered: ‎07-20-2011
Message 2 of 2 (448 Views)

Re: How to change plot device but leave default paper size (media name)?

04-04-2012 11:54 PM in reply to: Dasharnb777

The way to do this might depend on printer type etc.

1: If possible create two PC3 for one printer, one configured for A4 and one for A3.

2. you might change youre local printer calling printui.dll like this

    using System.Management;
    using System.Printing;

    ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.FileName = "rundll32.EXE";
        startInfo.Arguments = "Printui.dll,PrintUIEntry /ia /K /q /m "SHARP MX-5500N PS" /h "Windows NT x86" /v 3 /f sn0hwenu.inf";

        //.WshShell shell = new IWshRuntimeLibrary.WshShell();
        //string command = "RUNDLL32 PRINTUI.DLL,PrintUIEntry /k /n \"" + printerInfo.PrinterName + "\"";
        //object windowStyle = null;
        //object waitOnReturn = null;
        //shell.Run(command, ref windowStyle, ref waitOnReturn);


3. configure youre default printer with the required papersize, then export these settings

     rundll32 printui.dll,PrintUIEntry /Ss /n "ThePrinter" /a "C:\temp\ThePrinter_A4.dat" 9

    and import these settings with

     rundll32 printui.dll,PrintUIEntry /Sr /n "ThePrinter" /a "C:\temp\ThePrinter_A4.dat" 9


Set default printer: rundll32 printui.dll,PrintUIEntry /y /n "ThePrinter"


4. change registry,  see


     and HKEY_CURRENT_USER\Printers\DevModes2\

    settings might be exported and imported using DOS cmd

     C:\WINNT\system32\reg.exe import c:\temp\ThePrinter_A4.reg



These articles may give you some background.

    changing printing preferences

    Save/restore Devmode

    Set+Get Default printer via registry


Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.