Implementing a Custom "Whole Sheet Export" via UNO API to Preserve Hyperlinks in PDFs

When the “whole sheet export” option is enabled during the PDF export process in Calc,
the hyperlinks in the exported PDF do not preserve their original URLs and instead show local file paths.

References:

https://bugs.documentfoundation.org/show_bug.cgi?id=157780

Idea:
I’m considering using the UNO API to implement a custom solution that would:

Iterate through each sheet in a Calc document.
For each sheet, calculate the total width and height required to fit the content within one page, considering all columns and rows.
Generate a custom paper size based on these dimensions for each sheet.
Export to PDF with the custom paper size, ensuring that the “whole sheet export” option is not used, thus preserving the hyperlinks.

Question:
Is this approach feasible using the UNO API?

Thank you in advance for your insights!

this code can be a work around if you are using jod converter or uno:

it could be improved later

1 Like