ThisComponent.*
ThisComponent.CurrentController.*
ThisComponent.CurrentController.Frame
It would help tremendously to use an IDE with auto-completion)
I need to be able to convert a Writer document into PNGs. I wrote a book on Hobby Chemistry and was very careful about layout. I want to convert it into a Kindle format. When I convert it into PDF, the images flatten too far and lose color. When I try to use Amazon's conversion, the graphics fly all over the place. I want to convert it into a series of PNGs which I would include in a Word document that would then be imaged as a whole into an electronic book.
This is what I need:
Convert page by page using the document name and page number as unique filenames into a PNG with 300dpi.
This is what I got so far. I got it by tricking the spreadsheet app into recording my keystrokes into a macro. The writer app would not record.
Code: Select all
sub Main
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args(3) as new com.sun.star.beans.PropertyValue
args(0).Name = "URL"
rem... this needs to change to "file:///home/user/${doc_name} pg ${page_num}.png"
args(0).Value = "file:///home/user/asdfghj.png"
args(1).Name = "FilterName"
rem... this needs to change to Writer
args(1).Value = "calc_png_Export"
args(2).Name = "FilterData"
DV = com.sun.star.beans.PropertyState.DIRECT_VALUE
args(2).Value = Array(Array("PixelWidth",0,2550,DV),Array("PixelHeight",0,3300,DV))
args(3).Name = "SelectionOnly"
args(3).Value = false
dispatcher.executeDispatch(document, ".uno:ExportTo", "", 0, args())
end sub
DeMetalGimp