Hi,
We run a server-side document-to-PDF converter that drives headless LibreOffice through the UNO API (C++). We’re considering replacing it with Collabora Online’s REST conversion API (/cool/convert-to/pdf). Before deciding, we need to know whether Collabora Online can handle the customizations we apply to each document after loading and before PDF export.
What we do today with UNO
-
Writer – custom page size and margins on every page style (values come from our configuration):
Reference xPageStyles;xFamilies->getByName(“PageStyles”) >>= xPageStyles;
for (const OUString& name : xPageStyles->getElementNames())
{
Reference<XPropertySet> xStyle; xPageStyles->getByName(name) >>= xStyle; xStyle->setPropertyValue("Width", Any(sal_Int32(27940))); // 1/100 mm xStyle->setPropertyValue("Height", Any(sal_Int32(43180))); xStyle->setPropertyValue("IsLandscape", Any(false)); xStyle->setPropertyValue("TopMargin", Any(sal_Int32(1270))); xStyle->setPropertyValue("LeftMargin", Any(sal_Int32(1270))); // ... BottomMargin, RightMargin}
-
Writer – force a relative width on every table:
for (sal_Int32 i = 0; i < xTables->getCount(); ++i){
Reference<XPropertySet> xTable(xTables->getByIndex(i), UNO_QUERY); xTable->setPropertyValue("RelativeWidth", Any(sal_Int16(100))); xTable->setPropertyValue("LeftMargin", Any(sal_Int32(0))); xTable->setPropertyValue("RightMargin", Any(sal_Int32(0)));}
-
Accessibility fixes for PDF/UA (Writer, Impress, Draw):
- Set a fallback
Description(alt text) on images and shapes that have none. - Set
HyperLinkNameto the URL on hyperlinks whose name is empty.
- Set a fallback
-
Export with
storeToURLand theseFilterDataentries:PDFUACompliance,UseTaggedPDF,ExportBookmarksetc.,
Our Questions:
- Can the
FilterDataoptions in item 4 be passed to/cool/convert-to/pdf, for example through theoptionsform field as JSON? - Is there any supported way to apply the document-model changes in items 1–3 during a
convert-torequest? - if the answer to question 2 is no, what approach do you recommend for a conversion service that needs these changes?
Regards,
Satya