Hello,
I’m currently using a macro to export a Calc spreadsheet as PDF (and it works).
But my Calc file is password protected and I’d like to keep the password protection in the PDF as well.
I’ve read a few posts here and elsewhere about the code to add to the macro for this purpose but the most are very old, tried some but no one worked.
Does anyone know what code to add to password protect the pdf?
Here is my current macro:
sub ExportPDF_No_Confirm
rem define variables
dim document as object
dim dispatcher as object
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file://///PC1/user/mydocs/file1.pdf"
args1(1).Name = "FilterName"
args1(1).Value = "calc_pdf_Export"
dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1())
end sub