How can i modify the print function on libreoffice write

Hello Developers, I am in innovating machine as my thesis that is main related on LibreOffice…

I want to associate libreoffice on my program. my program is printing through coin operation system.
the scenario is… The file is automatically total the all pages to be print, before the printers begin to print. a MessageDialog appear first,by asking to drop a coin as how many amount that given on MessageDialog. Then after all requests are correctly responded the printer is now begin to print…
By the way i am using python code on my program… it is actually PYGTK for my GUI…

i am using libreofficee 3.6.x (i forgot x) and i want it to control under my python code… or any matter to control the printing behavior as long as connected to coin base system…
thanks a lot…

I don’t think you can modify the print dialog directly.

Depending on the underlying operating system, you could use your Python GUI to show the dialog, handle the coin payment, and upon successful payment receipt, shell out to LibreOffice to print the document or documents requested. (This also assumes the documents are saved to disk.)

I haven’t tested this, but something like:

from subprocess import call
call(["loffice", "-pt", "MyPrinterName", "printDocument1.odt", "printDocument2.odt"])

… using the subprocess module should get you the results you’re looking for.