@@ -44,6 +44,7 @@ source product.
44
44
using System ;
45
45
using System . Collections . Generic ;
46
46
using Common . Logging ;
47
+ using iText . IO . Util ;
47
48
using iText . Kernel ;
48
49
using iText . Kernel . Pdf . Action ;
49
50
using iText . Kernel . Pdf . Collection ;
@@ -69,6 +70,14 @@ public class PdfCatalog : PdfObjectWrapper<PdfDictionary> {
69
70
70
71
private bool outlineMode ;
71
72
73
+ private static readonly ICollection < PdfName > PAGE_MODES = new HashSet < PdfName > ( JavaUtil . ArraysAsList ( PdfName
74
+ . UseNone , PdfName . UseOutlines , PdfName . UseThumbs , PdfName . FullScreen , PdfName . UseOC , PdfName . UseAttachments
75
+ ) ) ;
76
+
77
+ private static readonly ICollection < PdfName > PAGE_LAYOUTS = new HashSet < PdfName > ( JavaUtil . ArraysAsList ( PdfName
78
+ . SinglePage , PdfName . OneColumn , PdfName . TwoColumnLeft , PdfName . TwoColumnRight , PdfName . TwoPageLeft , PdfName
79
+ . TwoPageRight ) ) ;
80
+
72
81
protected internal PdfCatalog ( PdfDictionary pdfObject )
73
82
: base ( pdfObject ) {
74
83
//This HashMap contents all pages of the document and outlines associated to them
@@ -173,9 +182,7 @@ public virtual iText.Kernel.Pdf.PdfCatalog SetAdditionalAction(PdfName key, PdfA
173
182
/// <param name="pageMode">page mode.</param>
174
183
/// <returns>current instance of PdfCatalog</returns>
175
184
public virtual iText . Kernel . Pdf . PdfCatalog SetPageMode ( PdfName pageMode ) {
176
- if ( pageMode . Equals ( PdfName . UseNone ) || pageMode . Equals ( PdfName . UseOutlines ) || pageMode . Equals ( PdfName . UseThumbs
177
- ) || pageMode . Equals ( PdfName . FullScreen ) || pageMode . Equals ( PdfName . UseOC ) || pageMode . Equals ( PdfName .
178
- UseAttachments ) ) {
185
+ if ( PAGE_MODES . Contains ( pageMode ) ) {
179
186
return Put ( PdfName . PageMode , pageMode ) ;
180
187
}
181
188
return this ;
@@ -188,9 +195,7 @@ public virtual PdfName GetPageMode() {
188
195
/// <summary>This method sets a page layout of the document</summary>
189
196
/// <param name="pageLayout"/>
190
197
public virtual iText . Kernel . Pdf . PdfCatalog SetPageLayout ( PdfName pageLayout ) {
191
- if ( pageLayout . Equals ( PdfName . SinglePage ) || pageLayout . Equals ( PdfName . OneColumn ) || pageLayout . Equals ( PdfName
192
- . TwoColumnLeft ) || pageLayout . Equals ( PdfName . TwoColumnRight ) || pageLayout . Equals ( PdfName . TwoPageLeft )
193
- || pageLayout . Equals ( PdfName . TwoPageRight ) ) {
198
+ if ( PAGE_LAYOUTS . Contains ( pageLayout ) ) {
194
199
return Put ( PdfName . PageLayout , pageLayout ) ;
195
200
}
196
201
return this ;
0 commit comments