From dev-return-61023-archive-asf-public=cust-asf.ponee.io@pdfbox.apache.org Mon Jan 28 05:52:07 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 85ED4180600 for ; Mon, 28 Jan 2019 05:52:06 +0100 (CET) Received: (qmail 88359 invoked by uid 500); 28 Jan 2019 04:52:05 -0000 Mailing-List: contact dev-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list dev@pdfbox.apache.org Received: (qmail 88348 invoked by uid 99); 28 Jan 2019 04:52:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jan 2019 04:52:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 1BC70C2338 for ; Mon, 28 Jan 2019 04:52:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 51G6VP3wguYo for ; Mon, 28 Jan 2019 04:52:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 8B268623BD for ; Mon, 28 Jan 2019 04:52:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 9E940E2699 for ; Mon, 28 Jan 2019 04:52:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id CD83024378 for ; Mon, 28 Jan 2019 04:52:00 +0000 (UTC) Date: Mon, 28 Jan 2019 04:52:00 +0000 (UTC) From: "DerekLiu (JIRA)" To: dev@pdfbox.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (PDFBOX-4445) Need fix accessibility issue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PDFBOX-4445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] DerekLiu updated PDFBOX-4445: ----------------------------- Description: Using Adobe Acrobat Pro DC to check the accessibility issue, it reported that: Primary language Failed Text language is specified Title Failed Document title is showing in title bar So we may need change the code to support it pass, could you please fix this? {code} .../java/org/apache/pdfbox/multipdf/PDFMergerUtility.java | 15 +++++++++++++++ .../main/java/org/apache/pdfbox/pdfparser/COSParser.java | 3 +++ 2 files changed, 18 insertions(+) diff --git a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java index b0474f2b9..be01d32c9 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java @@ -72,6 +72,7 @@ import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocume import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem; import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; import org.apache.pdfbox.pdmodel.interactive.form.PDField; +import org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences; /** * This class will take a list of pdf documents and merge them, saving the @@ -422,12 +423,26 @@ public class PDFMergerUtility } tobeclosed.add(sourceDoc); appendDocument(destination, sourceDoc); + + if ( destinationDocumentInformation == null && sourceDoc.getDocumentInformation() != null ) { + destinationDocumentInformation = sourceDoc.getDocumentInformation(); + destination.getDocumentCatalog().setLanguage( sourceDoc.getDocumentCatalog().getLanguage() ); + } } // optionally set meta data if (destinationDocumentInformation != null) { destination.setDocumentInformation(destinationDocumentInformation); + if ( destinationDocumentInformation.getTitle() != null ) { + if ( destination.getDocumentCatalog().getViewerPreferences() == null ) { + destination.getDocumentCatalog().setViewerPreferences( new PDViewerPreferences( new COSDictionary() ) ); + } + destination.getDocumentCatalog().getViewerPreferences().setDisplayDocTitle( true ); + } + if ( destinationDocumentInformation.getCOSObject().getString( COSName.LANG ) != null ) { + destination.getDocumentCatalog().setLanguage( destinationDocumentInformation.getCOSObject().getString( COSName.LANG ) ); + } } if (destinationMetadata != null) { diff --git a/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java b/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java index 8ca955ed2..b2b28b258 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java @@ -721,6 +721,9 @@ public class COSParser extends BaseParser } } + if( fileOffset == null ) { + continue; + } List stmObjects = objToBeParsed.get(fileOffset); if (stmObjects == null) { {code} was: Using Adobe Acrobat Pro DC to check the accessibility issue, it reported that: Primary language Failed Text language is specified Title Failed Document title is showing in title bar So we may need change the code to support it pass, could you please fix this? {code} .../main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java | 10 ++++++++++ .../src/main/java/org/apache/pdfbox/pdfparser/COSParser.java | 3 +++ 2 files changed, 13 insertions(+) diff --git a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java index b0474f2b9..472729ea4 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java @@ -72,6 +72,7 @@ import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocume import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem; import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; import org.apache.pdfbox.pdmodel.interactive.form.PDField; +import org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences; /** * This class will take a list of pdf documents and merge them, saving the @@ -428,6 +429,15 @@ public class PDFMergerUtility if (destinationDocumentInformation != null) { destination.setDocumentInformation(destinationDocumentInformation); + if ( destinationDocumentInformation.getTitle() != null ) { + if ( destination.getDocumentCatalog().getViewerPreferences() == null ) { + destination.getDocumentCatalog().setViewerPreferences( new PDViewerPreferences( new COSDictionary() ) ); + } + destination.getDocumentCatalog().getViewerPreferences().setDisplayDocTitle( true ); + } + if ( destinationDocumentInformation.getCOSObject().getString( COSName.LANG ) != null ) { + destination.getDocumentCatalog().setLanguage( destinationDocumentInformation.getCOSObject().getString( COSName.LANG ) ); + } } if (destinationMetadata != null) { diff --git a/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java b/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java index 8ca955ed2..b2b28b258 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java @@ -721,6 +721,9 @@ public class COSParser extends BaseParser } } + if( fileOffset == null ) { + continue; + } List stmObjects = objToBeParsed.get(fileOffset); if (stmObjects == null) { {code} > Need fix accessibility issue > ---------------------------- > > Key: PDFBOX-4445 > URL: https://issues.apache.org/jira/browse/PDFBOX-4445 > Project: PDFBox > Issue Type: Bug > Components: Utilities > Affects Versions: 3.0.0 PDFBox > Reporter: DerekLiu > Priority: Major > > Using Adobe Acrobat Pro DC to check the accessibility issue, it reported that: > Primary language Failed Text language is specified > Title Failed Document title is showing in title bar > So we may need change the code to support it pass, could you please fix this? > {code} > .../java/org/apache/pdfbox/multipdf/PDFMergerUtility.java | 15 +++++++++++++++ > .../main/java/org/apache/pdfbox/pdfparser/COSParser.java | 3 +++ > 2 files changed, 18 insertions(+) > diff --git a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java > index b0474f2b9..be01d32c9 100644 > --- a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java > +++ b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java > @@ -72,6 +72,7 @@ import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocume > import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem; > import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; > import org.apache.pdfbox.pdmodel.interactive.form.PDField; > +import org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences; > > /** > * This class will take a list of pdf documents and merge them, saving the > @@ -422,12 +423,26 @@ public class PDFMergerUtility > } > tobeclosed.add(sourceDoc); > appendDocument(destination, sourceDoc); > + > + if ( destinationDocumentInformation == null && sourceDoc.getDocumentInformation() != null ) { > + destinationDocumentInformation = sourceDoc.getDocumentInformation(); > + destination.getDocumentCatalog().setLanguage( sourceDoc.getDocumentCatalog().getLanguage() ); > + } > } > > // optionally set meta data > if (destinationDocumentInformation != null) > { > destination.setDocumentInformation(destinationDocumentInformation); > + if ( destinationDocumentInformation.getTitle() != null ) { > + if ( destination.getDocumentCatalog().getViewerPreferences() == null ) { > + destination.getDocumentCatalog().setViewerPreferences( new PDViewerPreferences( new COSDictionary() ) ); > + } > + destination.getDocumentCatalog().getViewerPreferences().setDisplayDocTitle( true ); > + } > + if ( destinationDocumentInformation.getCOSObject().getString( COSName.LANG ) != null ) { > + destination.getDocumentCatalog().setLanguage( destinationDocumentInformation.getCOSObject().getString( COSName.LANG ) ); > + } > } > if (destinationMetadata != null) > { > diff --git a/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java b/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java > index 8ca955ed2..b2b28b258 100644 > --- a/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java > +++ b/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java > @@ -721,6 +721,9 @@ public class COSParser extends BaseParser > } > } > > + if( fileOffset == null ) { > + continue; > + } > List stmObjects = objToBeParsed.get(fileOffset); > if (stmObjects == null) > { > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org For additional commands, e-mail: dev-help@pdfbox.apache.org