Bug 157668 - Allow passing parameters to graphic export filters
Summary: Allow passing parameters to graphic export filters
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyMedium, easyHack, skillCpp
Depends on:
Blocks: Commandline
  Show dependency treegraph
 
Reported: 2023-10-09 15:11 UTC by Mike Kaganski
Modified: 2023-10-10 03:13 UTC (History)
3 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 Mike Kaganski 2023-10-09 15:11:54 UTC
Since LibreOffice v.7.4, there is a way to pass any filter option available for PDF export, from the command line [1], [2].

The commit that enabled that was 0c3b8792b712e939d2ad524d554f96616b4844be.

Currently there is no way to pass e.g. dimensions, or resolution, or other parameters to the graphic export (PNG/JPEG/etc.) from the command line, because a command line like

> soffice --convert-to png:writer_png_Export:params_here example.odt

will pass the string "params_here" into the respective filter inside a property called "FilterOptions", while the filter only uses a property named "FilterData", which must be a sequence of beans::PropertyValue. See GraphicExportFilter::gatherProperties.

The idea is to implement a similar processing of FilterOptions in the gatherProperties, as implemented in the abovementioned commit for PDF. The syntax of the passed parameters should be the same as for the PDF, i.e. a JSON structure like

> soffice --convert-to 'png:writer_png_Export:{"PixelWidth":{"type":"long","value":"200"},"PixelHeight":{"type":"long","value":"100"}}' example.odt

[1] https://vmiklos.hu/blog/pdf-convert-to.html
[2] https://help.libreoffice.org/latest/en-US/text/shared/guide/pdf_params.html?DbPAR=SHARED
Comment 1 V Stuart Foote 2023-10-09 18:15:48 UTC
useful enhancement, +1