summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pdfwriter_impl.cxx
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@libreoffice.org>2019-09-20 19:01:34 +0200
committerArnaud Versini <arnaud.versini@libreoffice.org>2020-02-08 15:03:07 +0100
commita795886762a6a4aabd601183598c4e6c819bcb1f (patch)
tree93a58d738bf27a0c5f75f80dc7e651763916ee5f /vcl/source/gdi/pdfwriter_impl.cxx
parenta2f62a861ba7036e689070c47f72214b1bdd49d4 (diff)
Add minimum support for PDF/A3
Change-Id: I6ce3a3dbe71df1d3f56279879e3f91bd7c82f784 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84687 Tested-by: Jenkins Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Diffstat (limited to 'vcl/source/gdi/pdfwriter_impl.cxx')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 6726b02b7173..27a299d5aa2a 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1142,6 +1142,7 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
m_bIsPDF_A1( false ),
m_bIsPDF_A2( false ),
m_bIsPDF_UA( false ),
+ m_bIsPDF_A3( false ),
m_rOuterFace( i_rOuterFace )
{
m_aStructure.emplace_back( );
@@ -1232,6 +1233,10 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
if( m_bIsPDF_A2 )
m_aContext.Version = PDFWriter::PDFVersion::PDF_1_6; //we could even use 1.7 features
+ m_bIsPDF_A3 = (m_aContext.Version == PDFWriter::PDFVersion::PDF_A_3);
+ if( m_bIsPDF_A3 )
+ m_aContext.Version = PDFWriter::PDFVersion::PDF_1_6; //we could even use 1.7 features
+
if (m_aContext.UniversalAccessibilityCompliance)
{
m_bIsPDF_UA = true;
@@ -3167,7 +3172,7 @@ bool PDFWriterImpl::emitLinkAnnotations()
// i59651: key /F set bits Print to 1 rest to 0. We don't set NoZoom NoRotate to 1, since it's a 'should'
// see PDF 8.4.2 and ISO 19005-1:2005 6.5.3
aLine.append( "<</Type/Annot" );
- if( m_bIsPDF_A1 || m_bIsPDF_A2 )
+ if( m_bIsPDF_A1 || m_bIsPDF_A2 || m_bIsPDF_A3)
aLine.append( "/F 4" );
aLine.append( "/Subtype/Link/Border[0 0 0]/Rect[" );
@@ -3389,7 +3394,7 @@ bool PDFWriterImpl::emitNoteAnnotations()
// i59651: key /F set bits Print to 1 rest to 0. We don't set NoZoom NoRotate to 1, since it's a 'should'
// see PDF 8.4.2 and ISO 19005-1:2005 6.5.3
aLine.append( "<</Type/Annot" );
- if( m_bIsPDF_A1 || m_bIsPDF_A2 )
+ if( m_bIsPDF_A1 || m_bIsPDF_A2 || m_bIsPDF_A3 )
aLine.append( "/F 4" );
aLine.append( "/Subtype/Text/Rect[" );
@@ -3939,7 +3944,7 @@ bool PDFWriterImpl::emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDi
// PDF/A requires sub-dicts for /FT/Btn objects (clause
// 6.3.3)
- if( m_bIsPDF_A1 || m_bIsPDF_A2 )
+ if( m_bIsPDF_A1 || m_bIsPDF_A2 || m_bIsPDF_A3)
{
if( rWidget.m_eType == PDFWriter::RadioButton ||
rWidget.m_eType == PDFWriter::CheckBox ||
@@ -4221,7 +4226,7 @@ bool PDFWriterImpl::emitWidgetAnnotations()
}
else if( rWidget.m_aListEntries.empty() )
{
- if( !m_bIsPDF_A2 )
+ if( !m_bIsPDF_A2 && !m_bIsPDF_A3 )
{
// create a reset form action
aLine.append( "/AA<</D<</Type/Action/S/ResetForm>>>>\n" );
@@ -4644,7 +4649,7 @@ bool PDFWriterImpl::emitCatalog()
aLine.append( getResourceDictObj() );
aLine.append( " 0 R" );
// NeedAppearances must not be used if PDF is signed
- if( m_bIsPDF_A1 || m_bIsPDF_A2
+ if( m_bIsPDF_A1 || m_bIsPDF_A2 || m_bIsPDF_A3
#if HAVE_FEATURE_NSS
|| ( m_nSignatureObject != -1 )
#endif
@@ -4956,7 +4961,7 @@ sal_Int32 PDFWriterImpl::emitNamedDestinations()
// emits the output intent dictionary
sal_Int32 PDFWriterImpl::emitOutputIntent()
{
- if( !m_bIsPDF_A1 && !m_bIsPDF_A2 )
+ if( !m_bIsPDF_A1 && !m_bIsPDF_A2 && !m_bIsPDF_A3 )
return 0;
//emit the sRGB standard profile, in ICC format, in a stream, per IEC61966-2.1
@@ -5066,7 +5071,7 @@ static void escapeStringXML( const OUString& rStr, OUString &rValue)
// emits the document metadata
sal_Int32 PDFWriterImpl::emitDocumentMetadata()
{
- if (!m_bIsPDF_A1 && !m_bIsPDF_A2 && !m_bIsPDF_UA)
+ if( !m_bIsPDF_A1 && !m_bIsPDF_A2 && !m_bIsPDF_A3 )
return 0;
//get the object number for all the destinations
@@ -5080,6 +5085,8 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadata.mnPDF_A = 1;
else if (m_bIsPDF_A2)
aMetadata.mnPDF_A = 2;
+ else if (m_bIsPDF_A3)
+ aMetadata.mnPDF_A = 3;
aMetadata.mbPDF_UA = m_bIsPDF_UA;