summaryrefslogtreecommitdiffstats
path: root/desktop
diff options
context:
space:
mode:
authorGabriel Masei <gabriel.masei@1and1.ro>2021-11-15 21:05:17 +0200
committerJan Holesovsky <kendy@collabora.com>2021-11-25 12:12:00 +0100
commit3eb9eb9906c93fd7b1d1d8461bd34ea5a1ef2fa3 (patch)
tree9df8ddee81d80dbfef56231bf681f5f989c770ef /desktop
parentloplugin:stringliteraldefine in extensions (diff)
downloadcore-3eb9eb9906c93fd7b1d1d8461bd34ea5a1ef2fa3.tar.gz
core-3eb9eb9906c93fd7b1d1d8461bd34ea5a1ef2fa3.zip
lok: add pdf version option for export
Change-Id: I02c1edecd291309bf028e6e5a0f04a578ac1b639 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125255 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2191a87f5b87..5b6c941e2d08 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2908,6 +2908,33 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
bool bFullSheetPreview = sFullSheetPreview == "true";
+ // Select a pdf version if specified a valid one. If not specified then ignore.
+ // If invalid then fail.
+ sal_Int32 pdfVer = 0;
+ if ((aIndex = aFilterOptions.indexOf(",PDFVer=")) >= 0)
+ {
+ int bIndex = aFilterOptions.indexOf("PDFVEREND");
+ OUString sPdfVer;
+ sPdfVer = aFilterOptions.subView(aIndex+8, bIndex-(aIndex+8));
+ aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + aFilterOptions.subView(bIndex+9);
+
+ if (sPdfVer.equalsIgnoreAsciiCase("PDF/A-1b"))
+ pdfVer = 1;
+ else if (sPdfVer.equalsIgnoreAsciiCase("PDF/A-2b"))
+ pdfVer = 2;
+ else if (sPdfVer.equalsIgnoreAsciiCase("PDF/A-3b"))
+ pdfVer = 3;
+ else if (sPdfVer.equalsIgnoreAsciiCase("PDF-1.5"))
+ pdfVer = 15;
+ else if (sPdfVer.equalsIgnoreAsciiCase("PDF-1.6"))
+ pdfVer = 16;
+ else
+ {
+ SetLastExceptionMsg("wrong PDF version");
+ return false;
+ }
+ }
+
// 'TakeOwnership' == this is a 'real' SaveAs (that is, the document
// gets a new name). When this is not provided, the meaning of
// saveAs() is more like save-a-copy, which allows saving to any
@@ -2944,6 +2971,9 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
if (bFullSheetPreview)
aFilterDataMap["SinglePageSheets"] <<= true;
+ if (pdfVer)
+ aFilterDataMap["SelectPdfVersion"] <<= pdfVer;
+
if (!aFilterDataMap.empty())
{
aSaveMediaDescriptor["FilterData"] <<= aFilterDataMap.getAsConstPropertyValueList();