Kaydet (Commit) d43e6196 authored tarafından Miklos Vajna's avatar Miklos Vajna

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/59180Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
üst 5b8007af
...@@ -575,6 +575,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& ...@@ -575,6 +575,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
mbEncrypt = false; // no encryption mbEncrypt = false; // no encryption
xEnc.clear(); xEnc.clear();
break; 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 // copy in context the values default in the constructor or set by the FilterData sequence of properties
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
enum class Orientation { Portrait, Inherit }; 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 // 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 // for the meaning of DestAreaType please look at PDF Reference Manual
// version 1.4 section 8.2.1, page 475 // version 1.4 section 8.2.1, page 475
enum class DestAreaType { XYZ, FitRectangle }; enum class DestAreaType { XYZ, FitRectangle };
......
...@@ -1412,6 +1412,8 @@ void PdfExportTest::testTdf113143() ...@@ -1412,6 +1412,8 @@ void PdfExportTest::testTdf113143()
// ReduceImageResolution is on by default and that hides the bug we // ReduceImageResolution is on by default and that hides the bug we
// want to test. // want to test.
{ "ReduceImageResolution", uno::Any(false) }, { "ReduceImageResolution", uno::Any(false) },
// Set a custom PDF version.
{ "SelectPdfVersion", uno::makeAny(static_cast<sal_Int32>(16)) },
})); }));
aMediaDescriptor["FilterData"] <<= aFilterData; aMediaDescriptor["FilterData"] <<= aFilterData;
exportAndParse(aURL, aMediaDescriptor); exportAndParse(aURL, aMediaDescriptor);
...@@ -1456,6 +1458,12 @@ void PdfExportTest::testTdf113143() ...@@ -1456,6 +1458,12 @@ void PdfExportTest::testTdf113143()
// This failed, both were 319, now nSmaller is 169. // This failed, both were 319, now nSmaller is 169.
CPPUNIT_ASSERT_LESS(nLarger, nSmaller); 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() void PdfExportTest::testForcePoint71()
......
...@@ -1796,6 +1796,7 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal ...@@ -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; case PDFWriter::PDFVersion::PDF_1_4: aBuffer.append( "1.4" );break;
default: default:
case PDFWriter::PDFVersion::PDF_1_5: aBuffer.append( "1.5" );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) // append something binary as comment (suggested in PDF Reference)
aBuffer.append( "\n%\303\244\303\274\303\266\303\237\n" ); aBuffer.append( "\n%\303\244\303\274\303\266\303\237\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment