OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Print multiple pages & select tray

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
xentia
Newbie
Newbie


Joined: 15 Nov 2011
Posts: 1

PostPosted: Tue Nov 15, 2011 8:45 am    Post subject: Print multiple pages & select tray Reply with quote

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
View user's profile Send private message
zenlord
Power User
Power User


Joined: 24 Nov 2006
Posts: 53

PostPosted: Mon Jan 30, 2012 11:47 pm    Post subject: Reply with quote

I have written a set of macro's that does just that. You can find them on this forum by searching for threads I started.

At the moment however, I'm experiencing problems with these macro's, probably because of one of these bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=39220
https://bugs.freedesktop.org/show_bug.cgi?id=43932

HTH
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group