Page 1 of 1

Determining PDF Export Options

Posted: Mon Aug 14, 2023 4:49 pm
by ms777
The PDF export options are not very well documented and difficult to find in the source code. The below macro calls the PDF dialog from a calc document and writes the options you set into the first sheet.
The available export parameters are also listed for information for AO and LO.

Code: Select all

Sub GetFilterdataFromPdfExportDialog

oDoc = ThisComponent

oo = createUnoService("com.sun.star.document.PDFDialog")
oo.setSourceDocument(oDoc)

oo.execute()

oProp = oo.PropertyValues(0)

if oProp.Name <> "FilterData" then
  msgbox "Houston ..."
  exit sub
endif

OOoReflection = CreateUnoService("com.sun.star.reflection.CoreReflection") 'copied that from the great Xray ...
oSheet = ThisComponent.Sheets.getByIndex(0)
oSheet.clearContents(com.sun.star.sheet.CellFlags.VALUE + com.sun.star.sheet.CellFlags.DATETIME + com.sun.star.sheet.CellFlags.STRING + com.sun.star.sheet.CellFlags.FORMULA)

args = oProp.Value
for k=0 to UBound(args)
  arg = args(k)
  if (arg.Name <> "") then
    oSheet.getCellByPosition(0, k).setFormula(arg.Name)
		
    sType = OOoReflection.getType(arg.Value).Name
    if (sType="byte") or (sType="string") or (sType="boolean") or (sType="int") or (sType="long") then
      oSheet.getCellByPosition(1, k).setString(arg.Value)
    endif
		
    oSheet.getCellByPosition(2, k).setString(sType)

    endif
next

End Sub

Re: Determining PDF Export Options

Posted: Thu Aug 17, 2023 3:23 pm
by JPL
Detailed and IMO excellent info about the PDF export options can be found on next page of the OpenOffice wiki :

https://wiki.openoffice.org/wiki/API/Tu ... PDF_export

Thanks anyway for your code.

Re: Determining PDF Export Options

Posted: Sat Aug 19, 2023 11:32 am
by ms777
@JPL,

thanks for the wiki page. I should do more thorough search before posting ...

In an LO forum post https://ask.libreoffice.org/t/java-uno- ... port/94613, mikekaganski gave also this reference for LO pdf export options: https://help.libreoffice.org/master/en- ... arams.html