| View previous topic :: View next topic |
| Author |
Message |
xentia Newbie

Joined: 15 Nov 2011 Posts: 1
|
Posted: Tue Nov 15, 2011 8:45 am Post subject: Print multiple pages & select tray |
|
|
Hi,
I'm trying to write a macro that has to print multiple pages on one page (XPagePrintable interface) and also would like it to be able to select the printer paper tray automatically.
I tried to use the page styles but I think that parameter is ignored when using the printPages method.
Here's the code :
| Code: |
DIM oDoc AS Object
oDoc = ThisComponent
DIM mPrinterOpts(0) AS NEW com.sun.star.beans.PropertyValue
mPrinterOpts(0).Name = "Name"
mPrinterOpts(0).Value = "Canon"
oDoc.Printer = mPrinterOpts()
DIM mPageSettings(3) AS NEW com.sun.star.beans.PropertyValue
mPageSettings(0).Name = "PageRows"
mPageSettings(0).Value = PagesPerSheet
mPageSettings(1).Name = "IsLandscape"
mPageSettings(1).Value = false
mPageSettings(2).Name = "TopMargin"
mPageSettings(2).Value = 0
mPageSettings(3).Name = "PageColumns"
mPageSettings(3).Value = 1
DIM oStyle AS Object
DIM sPageStyle AS String
sPageStyle = oDoc.CurrentController.getViewCursor().PageStyleName
ostyle = oDoc.StyleFamilies.getByName("PageStyles").getByName(sPageStyle)
oStyle.PrinterPaperTray = "lateau d'alimentation"
oDoc.setPagePrintSettings(mPageSettings)
DIM mPrintOpts(1) AS NEW com.sun.star.beans.PropertyValue
mPrintOpts(0).Name = "Pages"
mPrintOpts(0).Value = mPages
mPrintOpts(1).Name = "CopyCount"
mPrintOpts(1).Value = mCopies
oDoc.PrintPages(mPrintOpts)
|
Hope someone can help me... Thanks |
|
| Back to top |
|
 |
zenlord Power User

Joined: 24 Nov 2006 Posts: 53
|
|
| Back to top |
|
 |
|