Bug 138651 - PDF opened with DRAW from WEBDAV LINKS are not saved back at the remote location
Summary: PDF opened with DRAW from WEBDAV LINKS are not saved back at the remote location
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
(earliest affected) release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
Reported: 2020-12-03 23:28 UTC by Lionel VEST
Modified: 2020-12-04 15:46 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Lionel VEST 2020-12-03 23:28:01 UTC
Hi. I'm developing a free opensource software for lawfirms. I get a very satisfying workflow using the ability of LibreOffice to open webdav links (https://cloud.mydomain.com/files/test.odt). The only anoying thing is with PDF files. They open fine with DRAW. I can easily edit them. But when I want to save, it doesn't save back the PDF on the WEBDAV remote location. It asks to save in ODG format LOCALLY.  I also tried to use "EXPORT DIRECTLY AS PDF" but instead of saving back to the WEBDAV, it once again ask to save the PDF LOCALLY. My suggestion : if DRAW opens a PDF, it should save as PDF directly on the WEBDAV. Or at least it should save on the WEBDAV when choosing EXPORT DIRECTLY AS PDF. What do you think about that ?

Steps to Reproduce:
1.Open a PDF in DRAW from a webdav link (example : https://cloud.mydomain.com/test.pdf)
2.Edit the PDF, for example move a text box
3.Save the PDF

Actual Results:
It asks to save locally as ODG format
Export Directly to PDF function asks to save a new pdf locally

Expected Results:
It should save as PDF at the remote location, like WRITER does with ODT files opened from WEBDAV.
At least, if that's not possible, the EXPORT DIRECTLY AS PDF function should save remotely and not ask to create a new file locally

Reproducible: Always

User Profile Reset: No

Additional Info:
Thanks for the amazing work on Libreoffice !
Comment 1 Mike Kaganski 2020-12-04 06:02:18 UTC
LibreOffice deliberately uses *different* import and export filters for PDF, which makes the format not editable, and PDF appearing only in Export dialog, not in Save As.

LibreOffice is not developed as a PDF editor. Its support for PDFs is very limited, in many areas: from major shortcomings (like not supporting different page layouts in a single Draw file, which might improve over time) to things that may not change - such as incompatible document model, which prevents LO from keeping most of original PDF internal structure/metadata when round-tripping.

Pretending that LO "supports" PDF editing would result in much user confusion, when people will expect LO to keep the information it can't, and many bug reports for something that is not meant to work anyway.

Comment 2 Lionel VEST 2020-12-04 14:27:08 UTC
I totally understand your point about user confusion.

Then let me rephrase.
it's mainly a workflow problem.
All I want is the ability to EXPORT my work at the same place that was opened.
If I open file.pdf on my DAV, I want it to export the changes by overwriting the same file.pdf at the same remote location without asking any question.
That's exactly what Writer is doing when opening an ODT file through a remove webdav link.

Without this workflow my users can't save their changes to their webdav server.
They have to :
- configure the SAVE AS REMOTE and brows to the good directory.
- mount their webdav as a disk
My users are lawyers and just don't understand that kind of stuff.

What is missing is just a function called "EXPORT -> SAVE PDF AT REMOTE DIRECTLY"
Comment 3 Mike Kaganski 2020-12-04 15:18:34 UTC
Saving (or exporting) to the same location is exactly pretending that the format is considered editable and supported read-write format. This is not true for PDF. For now the request is WONTFIX.

However, this is exactly the task for custom macros, when someone has some specific needs, and understands that their workflow has limitations, but needs something that is not supported by the program. Here is such a macro, which you may put to common library for your users, and create a button for it:

Sub ExportAsSelf
    doc = ThisComponent
    If doc.hasLocation and not doc.isReadonly Then
      url = doc.getLocation
      doc.storeToURL(url, array())
    End If
End Sub
Comment 4 V Stuart Foote 2020-12-04 15:26:52 UTC
(In reply to Mike Kaganski from comment #3)
> Saving (or exporting) to the same location is exactly pretending that the
> format is considered editable and supported read-write format. This is not
> true for PDF. For now the request is WONTFIX.

True, as the PDF opening filter had developed--the consensus had been that the export filter round-trip would never overwrite the PDF source document. LibreOffice is not a PDF editor.

But export handling was changed for https://bugzilla.redhat.com/show_bug.cgi?id=1673198 and bug 103947, with https://gerrit.libreoffice.org/c/core/+/67491

So a PDF opened in Draw *can* be exported to overwrite its source, at least locally. 

If not the case with a WebDav linkage, that is something different?
Comment 5 Mike Kaganski 2020-12-04 15:38:56 UTC
Sorry for the incomplete macro. The one in comment 3 will save the file with PDF extension, but in ODF format. Here is the better one:

Sub ExportAsSelf
  doc = ThisComponent
  If doc.hasLocation And Not doc.isReadonly Then
    url = doc.getLocation
    args = doc.getArgs
    For i = LBound(args) To UBound(args)
      If args(i).Name = "FilterName" Then
        If args(i).Value = "draw_pdf_import" Then args(i).Value = "draw_pdf_Export"
      End If
    Next i
    doc.storeToURL(url, args)
  End If
End Sub
Comment 6 Lionel VEST 2020-12-04 15:46:42 UTC
Thanks for the MACRO
I'll try that !