go-libreofficekit icon indicating copy to clipboard operation
go-libreofficekit copied to clipboard

How to retain URLs when calling document.SaveAs

Open echarrod opened this issue 3 years ago • 0 comments

When I use document.SaveAs with "pdf" as the extension (and a .docx as the input file), the URL links are stripped:

// SaveAs saves document at desired path in desired format with applied filter rules
// Actual (from libreoffice) error message can be read with Office.GetError
func (document *Document) SaveAs(path string, format string, filter string) error {
	cPath := C.CString(path)
	defer C.free(unsafe.Pointer(cPath))
	cFormat := C.CString(format)
	defer C.free(unsafe.Pointer(cFormat))
	cFilter := C.CString(filter)
	defer C.free(unsafe.Pointer(cFilter))
	status := C.document_save(document.handle, cPath, cFormat, cFilter)
	if status != 1 {
		return fmt.Errorf("Failed to save document")
	}
	return nil
}

Is it possible to retain these with a filter option?

echarrod avatar Mar 23 '21 10:03 echarrod