[Libreoffice-commits] core.git: filter/source include/vcl vcl/qa vcl/source

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


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

New commits:
commit d43e61962c5abdb435eff08c64a5476dfb99028a
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 19:25:54 2018 +0200

    PDF export: allow API users to opt in for version 1.6
    
    Don't make it the default yet, though.
    
    Change-Id: Ida56eb25a84bf5425d4879c062c084bb68984d9a
    Reviewed-on: https://gerrit.libreoffice.org/59180
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 0df62a459ef3..ed1e0b5ad95c 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -575,6 +575,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 3c9afafc8180..8e494d796292 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -103,7 +103,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 edcd95af9281..cbd42a738c31 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1412,6 +1412,8 @@ void PdfExportTest::testTdf113143()
         // ReduceImageResolution is on by default and that hides the bug we
         // want to test.
         { "ReduceImageResolution", uno::Any(false) },
+        // Set a custom PDF version.
+        { "SelectPdfVersion", uno::makeAny(static_cast<sal_Int32>(16)) },
     }));
     aMediaDescriptor["FilterData"] <<= aFilterData;
     exportAndParse(aURL, aMediaDescriptor);
@@ -1456,6 +1458,12 @@ void PdfExportTest::testTdf113143()
 
     // This failed, both were 319, now nSmaller is 169.
     CPPUNIT_ASSERT_LESS(nLarger, nSmaller);
+
+    // The following check used to fail in the past, header was "%PDF-1.5":
+    maMemory.Seek(0);
+    OString aExpectedHeader("%PDF-1.6");
+    OString aHeader(read_uInt8s_ToOString(maMemory, aExpectedHeader.getLength()));
+    CPPUNIT_ASSERT_EQUAL(aExpectedHeader, aHeader);
 }
 
 void PdfExportTest::testForcePoint71()
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index cb58e6ce8842..38e1ab075363 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1796,6 +1796,7 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
         case PDFWriter::PDFVersion::PDF_1_4: aBuffer.append( "1.4" );break;
         default:
         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