I create a pdf file using this basic code:
sub ExportToPDF(documentIn as object, URL as String)
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = documentIn.CurrentController.Frame
dispatcher = createUnoService(“com.sun.star.frame.DispatchHelper”)
rem ----------------------------------------------------------------------
'dispatcher.executeDispatch(document, “.uno:SaveAs”, “”, 0, Array())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = “URL”
args2(0).Value = URL
args2(1).Name = “FilterName”
args2(1).Value = “writer_pdf_Export”
'dispatcher.executeDispatch(document, “.uno:ExportDirectlyToPDF”, “”, 0, args2())
documentIn.storeToURL(URL, storeArgs())
end sub
The resultant pdf opens in Writer but not in my Windows 11 Chrome browser.
In ubuntu I run this and get the listed results:
root@minion2:/var/www/gas# pdfinfo working/test_out.pdf
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error (12): Illegal character ‘}’
Syntax Error: Couldn’t find trailer dictionary
Syntax Error: Couldn’t find trailer dictionary
Syntax Error: Couldn’t read xref table
root@minion2:/var/www/gas#