[Libreoffice-commits] core.git: Branch 'distro/vector/vector-5.4' - filter/source include/vcl vcl/qa vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 17:14:47 UTC 2018


 filter/source/pdf/pdfexport.cxx        |    3 +++
 include/vcl/pdfwriter.hxx              |    2 +-
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |    9 ++++++++-
 vcl/source/gdi/pdfwriter_impl.cxx      |    1 +
 4 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 11531b92eeae8feaa49e74f9992b6c3b781ec8f8
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Aug 16 15:45:00 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Thu Aug 16 18:16:14 2018 +0200

    PDF export: allow API users to opt in for version 1.6
    
    Don't make it the default yet, though.
    
    Conflicts:
            vcl/qa/cppunit/pdfexport/pdfexport.cxx
    
    Change-Id: Ida56eb25a84bf5425d4879c062c084bb68984d9a

diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 4fdd7a450626..4458f485c613 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -572,6 +572,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
                 mbEncrypt = false;              // no encryption
                 xEnc.clear();
                 break;
+            case 16:
+                aContext.Version = vcl::PDFWriter::PDFVersion::PDF_1_6;
+                break;
             }
 
             // copy in context the values default in the constructor or set by the FilterData sequence of properties
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 78a28231ea10..66004c0c7362 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -105,7 +105,7 @@ public:
     enum class Orientation { Portrait, Inherit };
 
     // in case the below enum is added PDF_1_6 PDF_1_7, please add them just after PDF_1_5
-    enum class PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_A_1 };//i59651, PDF/A-1b & -1a, only -1b implemented for now
+    enum class PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_1_6, PDF_A_1 };//i59651, PDF/A-1b & -1a, only -1b implemented for now
     // for the meaning of DestAreaType please look at PDF Reference Manual
     // version 1.4 section 8.2.1, page 475
     enum class DestAreaType { XYZ, FitRectangle };
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 1a88b97e5364..1b2f03ddc089 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -156,7 +156,8 @@ void PdfExportTest::testTdf106059()
     // Explicitly enable the usage of the reference XObject markup.
     uno::Sequence<beans::PropertyValue> aFilterData =
     {
-        comphelper::makePropertyValue("UseReferenceXObject", true)
+        comphelper::makePropertyValue("UseReferenceXObject", true),
+        comphelper::makePropertyValue("SelectPdfVersion", static_cast<sal_Int32>(16))
     };
     aMediaDescriptor["FilterData"] <<= aFilterData;
     xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
@@ -181,6 +182,12 @@ void PdfExportTest::testTdf106059()
     // The image is a reference XObject.
     // This dictionary key was missing, so the XObject wasn't a reference one.
     CPPUNIT_ASSERT(pReferenceXObject->Lookup("Ref"));
+
+    // The following check used to fail in the past, header was "%PDF-1.5":
+    aStream.Seek(0);
+    OString aExpectedHeader("%PDF-1.6");
+    OString aHeader(read_uInt8s_ToOString(aStream, aExpectedHeader.getLength()));
+    CPPUNIT_ASSERT_EQUAL(aExpectedHeader, aHeader);
 }
 
 void PdfExportTest::testTdf106693()
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 1cbdd642b504..a742373d3195 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1816,6 +1816,7 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
         default:
         case PDFWriter::PDFVersion::PDF_1_4: aBuffer.append( "1.4" );break;
         case PDFWriter::PDFVersion::PDF_1_5: aBuffer.append( "1.5" );break;
+        case PDFWriter::PDFVersion::PDF_1_6: aBuffer.append( "1.6" );break;
     }
     // append something binary as comment (suggested in PDF Reference)
     aBuffer.append( "\n%\303\244\303\274\303\266\303\237\n" );


More information about the Libreoffice-commits mailing list