Hi there,
I am using the LibreOffice SDK (version 5) within .NET, basically I am converting a .docx document to a PDF but when I try to use the storeAsURL or storeToUrl methods an ErrorCodeIOException is being thrown (SfxBaseModel::impl_store file:///C:\Users\demo\Documents\test.pdf failed: 0×507), does anyone know why this might be? The code I am using is shown below:
Dim fileName As String = "file:///C:\Users\demo\Documents\test.docx"
' get the remote office component context
Dim xContext As XComponentContext
xContext = Bootstrap.bootstrap()
' get the remote office service manager
Dim xFactory As XMultiServiceFactory
xFactory = DirectCast(xContext.getServiceManager(), _
XMultiServiceFactory)
'Create the Desktop
Dim xComponentLoader As unoidl.com.sun.star.frame.XComponentLoader
xComponentLoader = DirectCast(xFactory.createInstance("com.sun.star.frame.Desktop"), _
unoidl.com.sun.star.frame.XComponentLoader)
Dim propertyValues(1) As unoidl.com.sun.star.beans.PropertyValue
propertyValues(0) = New unoidl.com.sun.star.beans.PropertyValue
propertyValues(0).Name = "Hidden"
propertyValues(0).Value = New uno.Any(True)
oDocToStore = xComponentLoader.loadComponentFromURL(fileName, "_blank", 0, propertyValues)
Dim xStorable As unoidl.com.sun.star.frame.XStorable
xStorable = DirectCast(oDocToStore, _
unoidl.com.sun.star.frame.XStorable)
' Setting the flag for overwriting
propertyValues(0) = New unoidl.com.sun.star.beans.PropertyValue
propertyValues(0).Name = "Overwrite"
propertyValues(0).Value = New uno.Any(True)
' Setting the filter name
propertyValues(1) = New unoidl.com.sun.star.beans.PropertyValue
propertyValues(1).Name = "FilterName"
propertyValues(1).Value = New uno.Any("writer_pdf_Export")
Dim index1 = fileName.LastIndexOf("/")
Dim index2 = fileName.LastIndexOf(".")
Dim storeUrl As String = "file:///C:\Users\demo\Documents\test.pdf"
' Storing and converting the document
xStorable.storeToURL(storeUrl, propertyValues)