Bug 162826 - Add password handling to pdfium ipdf filter to support insertion of encrypted PDF, correct current 'Image filter not found' error
Summary: Add password handling to pdfium ipdf filter to support insertion of encrypted...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
7.6.6.3 release
Hardware: All Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: PDF-Insert
  Show dependency treegraph
 
Reported: 2024-09-06 14:41 UTC by V Stuart Foote
Modified: 2024-09-09 11:42 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
24.2.5 PDF exported with user and permissions pw, for testing 'Insert as image' (15.60 KB, application/pdf)
2024-09-06 23:56 UTC, V Stuart Foote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description V Stuart Foote 2024-09-06 14:41:47 UTC
Tried to use the pdfium based  'Insert as image' for a PDF exported from 24.2 or 25.2 builds. Both had the passwords "open" and "permission" set for the PDF Security dialog.

When insert as image was attempted to Draw canvas or Writer document:

was expecting a password prompt to allow pdfium read of the PDF stream.

Instead LO responds with 'Image filter not found' error.

The encryption stanza inside the PDF shows 
/Filter/Standard/V 2/Length 128/R 3/

So is that choking the pdfium filter? Or does the pdfium insert just not know what to do with a password encrypted PDF?

=-tested-=

Version: 7.6.6.3 (X86_64) / LibreOffice Community
Build ID: d97b2716a9a4a2ce1391dee1765565ea469b0ae7
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 24.2.5.1 (X86_64) / LibreOffice Community
Build ID: 2ccb78ad6bdfe3f3356a7a7f294ec388775c5816
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1b61a0737e3600aadf42f28a15c70aface9ab61e
CPU threads: 8; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 1 V Stuart Foote 2024-09-06 14:53:03 UTC
Same LO document exported to PDF without password/encryption makes the round trip "Insert as image" with no issue.

@Miklos, * 

Is this an issue with our V2 level PDF export, or a limitation of recent pdfium lib handling (we claim PDF 1.7 but encrypt V2)?
Comment 2 V Stuart Foote 2024-09-06 15:21:51 UTC
And should have noted that the password "protected" PDF does open into Draw with either the "owner" or the "user" password provided at the LO 'Enter Password' popup.

So we can read it, filter import it back into draw with poppler. And this is just affecting the pdfium based insert.
Comment 3 V Stuart Foote 2024-09-06 15:28:54 UTC
(In reply to V Stuart Foote from comment #2)
> And should have noted that the password "protected" PDF does open into Draw
> with either the "owner" or the "user" password provided at the LO 'Enter
> Password' popup.
> 
> So we can read it, filter import it back into draw with poppler. And this is
> just affecting the pdfium based insert.

Likewise when opened into Chrome browser, where either the open or the permission pw is parsed when prompted and entered. So seems pdfium can handle it when fully configured.
Comment 4 m_a_riosv 2024-09-06 18:53:29 UTC
Hi, a sample file to insert as image, could be of help.
Comment 5 V Stuart Foote 2024-09-06 23:56:40 UTC
Created attachment 196291 [details]
24.2.5 PDF exported with user and permissions pw, for testing 'Insert as image'

user - 1234
permissions - 4567
Comment 6 m_a_riosv 2024-09-07 11:40:13 UTC
Reproducible
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1b61a0737e3600aadf42f28a15c70aface9ab61e
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
Comment 7 Miklos Vajna 2024-09-09 07:51:41 UTC
Right, probably just nobody implemented an interaction handler while opening a PDF as an image, so you fail without a password. Sounds like adding this small feature is a matter of somebody doing the work. :-)
Comment 8 V Stuart Foote 2024-09-09 11:42:23 UTC
(In reply to Miklos Vajna from comment #7)
> Right, probably just nobody implemented an interaction handler while opening
> a PDF as an image, so you fail without a password. Sounds like adding this
> small feature is a matter of somebody doing the work. :-)

OK, now an enhancement to do so...