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.
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";
Process.Start(startInfo);
//.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
HKEY_CURRENT_USER\Printers\DevModePerUser\ThePrinter
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
http://www.lessanvaezi.com/changing-printer-settings-using-the-windows-api/
Save/restore Devmode
http://nicholas.piasecki.name/blog/2008/11/programmatically-selecting-complex-printer-options-in-c-s...
Set+Get Default printer via registry
http://www.xtremedotnettalk.com/showthread.php?t=83348