Changing Paper size

F

felrayes

Hello,
Does anyone know how we can change the paper size for the current
active printer?
I need to change the paper size to a well known size (not a custom
size).
I tried something like the following:

PrinterSettings ps = new PrinterSettings();
ps.PrinterName = "MyPrinterName";
PrinterConfiguration pc = new PrinterConfiguration();
PageSettings paS = new PageSettings(ps);
for (int count = 0; count < ps.PaperSizes.Count; count++)
{
if (condition)
{
paS.PaperSize = ps.PaperSizes[count];
pc.ChangePrinterPaperSize("MyPrinterName",
paS.PaperSize);
paperSize = paS.PaperSize;
break;
}
}

Your help is greatly appreciated.

Ferass
 
J

Jonathan West

Hello,
Does anyone know how we can change the paper size for the current
active printer?
I need to change the paper size to a well known size (not a custom
size).
I tried something like the following:

PrinterSettings ps = new PrinterSettings();
ps.PrinterName = "MyPrinterName";
PrinterConfiguration pc = new PrinterConfiguration();
PageSettings paS = new PageSettings(ps);
for (int count = 0; count < ps.PaperSizes.Count; count++)
{
if (condition)
{
paS.PaperSize = ps.PaperSizes[count];
pc.ChangePrinterPaperSize("MyPrinterName",
paS.PaperSize);
paperSize = paS.PaperSize;
break;
}
}

Your help is greatly appreciated.

Ferass

You've posted C# code to a VBA group, so I'm not quite sure what your
objective is. If you want to know how to do this using Word VBA, take a look
at the following article


Controlling the Printer from Word VBA
Part 3: Dealing with Different Paper Sizes
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=132
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top