Bug 141732 - Each module should default to its own PDF import filter
Summary: Each module should default to its own PDF import filter
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 146412 (view as bug list)
Depends on:
Blocks: PDF-Import-Draw PDF-Import-Writer
  Show dependency treegraph
 
Reported: 2021-04-17 21:39 UTC by Eyal Rozenberg
Modified: 2023-07-05 21:43 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2021-04-17 21:39:52 UTC
I was recently very surprised to find out LO supports importing PDFs into apps other than Draw (see bug 141730). The reason is that when you open a PDF file in LO, regardless of which app you opened it with - it gets opened in LO Draw. Only if you scroll down the list of input format options and locate an app-specific PDF input filter, do you get the file imported into the app of your choice.

So, in addition to the inconvenience of doing this, there's the fact that, like me, I'm sure many users are simply not aware of the existence of these input filters!

It would make more sense, be more convenient, and expose this filters, if the PDF input filter used by default (or perhaps I should say selected by default on the list?) would depend  on the app from which one is opening the file. Behavior when opening from a (non-LO) file manager is also interesting to consider but not in this bug, so I'm not making any suggestions about it.
Comment 1 Telesto 2021-04-18 07:54:04 UTC
Interesting. Didn't know either
Comment 2 V Stuart Foote 2021-04-18 15:20:02 UTC
Suppose it would be possible to establish a per module Document Service based filter detection (like the filterdetect.cxx used for CSV (various formats) into Writer or Calc [1]).

The Document Service is linked to the active LO module the request comes in from (Draw, Impress, Writer) and would then use the associated PDF import filter rather than the default import filter into Draw.

But that would be a lot of dev effort for what really is a corner case filter import use. LO's own file manager, or the integration to use os/DE file manager to select the document type/filter seems sufficient.

=-ref-=

[1] https://opengrok.libreoffice.org/xref/core/filter/source/textfilterdetect/filterdetect.cxx?r=ada07f30#33
Comment 3 Heiko Tietze 2021-04-19 07:28:05 UTC
All modules except Calc. Let's filter Writer or Impress when the PDF is opened from this module, otherwise Draw.
Comment 4 Eyal Rozenberg 2021-04-19 09:35:40 UTC
(In reply to V Stuart Foote from comment #2)

As I'm not a developer, I can't speak to how much work this actually entails, but - there is justification for module-specific behavior of the file picker even regardless of this bug (although maybe I should open a separate issue about that). At any rate - how hard can it be to make the file picker wrapper code accept an optional mapping of file types to default open filters?

> for what really is a corner case filter import use.

On the contrary - it is arguably the main case for opening PDFs, since:

* One rarely opens PDFs from the "non-specific module" (what you get when you start LO with no switches and no documents)
* When opening a PDF using the DE, there is typically(/always) just a single LO option, which is opening in Draw.

> file manager to select the document type/filter seems sufficient.

It's insufficient, so much as that even relatively experienced users fail to realize this is at all possible. And with the desktop environment it's not made possible (at least - with many desktop environments; maybe with all of them).
Comment 5 Eyal Rozenberg 2021-04-19 09:37:22 UTC
(In reply to Heiko Tietze from comment #3)
> All modules except Calc. Let's filter Writer or Impress when the PDF is
> opened from this module, otherwise Draw.

The interesting modules AFAIAC are Draw, Writer and Impress. The behavior you suggest seems fine.
Comment 6 Kevin Suo 2021-07-11 09:17:08 UTC
Just a code pointer to those who are interested in:
When I open a PDF document from the start centre, the pickup of the "draw_pdf_import" filter seems to be determined by: 
PDFDetector::detect
in sdext/source/pdfimport/filterdet.cxx

You can observe this by setting a breakpoint when you are running LibreOffice using "make debugrun"
break sdext/source/pdfimport/filterdet.cxx:194

However, it is very strange that, when I manually choose "PDF - Portable Document Format (Writer)" from the file format list dropdown in the file open dialog, this code is never hit.
Comment 7 V Stuart Foote 2021-12-25 17:07:49 UTC
*** Bug 146412 has been marked as a duplicate of this bug. ***
Comment 8 Eyal Rozenberg 2021-12-25 19:41:40 UTC
(In reply to V Stuart Foote from comment #7)

Quoting from the dupe bug:

> Many users can not figure this out.

I'd say _most_ users who might want to import PDFs don't figure this out. They probably check by opening their PDF in Writer, seeing that it's Draw that gets opened, and give up.

> They resort to various less-then-ideal workarounds such as using online 
> converters and using MS Word to convert pdf to odt etc. See 
> https://ask.libreoffice.org/t/trying-to-convert-pdf-to-odt/45070/7

Indeed!

> Please improve your UI. At the very minimum a PDF opened via the Writer should 
> open in Writer.

This is my original ask here.

If that's difficult for the reasons V Stuart Foote gave, another alternative would be an "import filter" which makes the user select the module using a dialog, i.e. "Open this file in..." dialog; or perhaps an extra option in the Open File dialog, made visible only for a generic PDF import filter.

Also, marking this as a (usability) bug rather than a mere enhancement.