summaryrefslogtreecommitdiff
path: root/desktop/source/lib/init.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r--desktop/source/lib/init.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2e1bc71f626a..19b5578d704e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2731,6 +2731,34 @@ 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 invalid then fail.
+ // If not specified then ignore.
+ sal_Int32 pdfVer = 0;
+ if ((aIndex = aFilterOptions.indexOf(",PDFVer=")) >= 0)
+ {
+ int bIndex = aFilterOptions.indexOf("PDFVEREND");
+ OUString sPdfVer = aFilterOptions.copy(aIndex+8, bIndex-(aIndex+8));
+
+ OUString temp = aFilterOptions.copy(0, aIndex);
+ aFilterOptions = temp + aFilterOptions.copy(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
@@ -2767,6 +2795,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();