Macro Writer: print specific pages

Hi,
I want to create a button that will print specific pages of a document. I would like a window to appear after pressing this button with the completed pages to print. Does anyone know how to create such a macro?

Welcome!
I would appreciate it if you could tell us a little more about your problem.

“specific pages” - who and when defines these pages? How many of them are there in the entire document? Is it a large part of the document or several pages from a very large document? Why are you not satisfied with the ability to specify the numbers of the required pages directly in the print dialog?

image

Macros are not the only way to achieve what you want. For example, you can simply mark parts of the document as “not for printing” (enclose unnecessary parts of the document in the “Hide” section)

On first page of the dokument I create list with data to be entered. For example: start date, case number, prosecutor’s number, legal provision, personal data and a few others. On the next pages there are a lot of difirent official documents with that data. After entering data, I need to print specific pages in several cases, for example:

  1. On start case: 2, 5, 5, 5, 6, 7, 8, 9, 10, 10
  2. When the case will be completed: 11, 12, 11, 12, 11, 12, 11, 12, 13, 14, 14

I know there is that command:

dispatcher.executeDispatch(document, “.uno:Print”, “”, 0, Array())

but is there any arguments, where I can define pages to print? I would like to create buttons for users so that they don’t have to think about which pages they need to print.

When user clicks that button I want to something like that with entered pages:

From LibreOffice: XPrintable Interface Reference,
LibreOffice Developer's Guide: Chapter 7 - Text Documents - The Document Foundation Wiki
you should be able to go with PropertyValue "Pages" = "3-5,7"