@@ -52,16 +52,30 @@ source product.
52
52
using iText . Kernel . Pdf . Navigation ;
53
53
54
54
namespace iText . Kernel . Pdf {
55
+ /// <summary>The root of a document’s object hierarchy.</summary>
55
56
public class PdfCatalog : PdfObjectWrapper < PdfDictionary > {
56
57
private static readonly ILog LOGGER = LogManager . GetLogger ( typeof ( iText . Kernel . Pdf . PdfCatalog ) ) ;
57
58
58
59
private readonly PdfPagesTree pageTree ;
59
60
61
+ /// <summary>
62
+ /// Map of the
63
+ /// <see cref="PdfNameTree"/>.
64
+ /// </summary>
65
+ /// <remarks>
66
+ /// Map of the
67
+ /// <see cref="PdfNameTree"/>
68
+ /// . Used for creation
69
+ /// <c>name tree</c>
70
+ /// dictionary.
71
+ /// </remarks>
60
72
protected internal IDictionary < PdfName , PdfNameTree > nameTrees = new LinkedDictionary < PdfName , PdfNameTree
61
73
> ( ) ;
62
74
75
+ /// <summary>Defining the page labelling for the document.</summary>
63
76
protected internal PdfNumTree pageLabels ;
64
77
78
+ /// <summary>The document’s optional content properties dictionary.</summary>
65
79
protected internal PdfOCProperties ocProperties ;
66
80
67
81
private const String OutlineRoot = "Outlines" ;
@@ -83,6 +97,12 @@ public class PdfCatalog : PdfObjectWrapper<PdfDictionary> {
83
97
< PdfName > ( JavaUtil . ArraysAsList ( PdfName . SinglePage , PdfName . OneColumn , PdfName . TwoColumnLeft , PdfName .
84
98
TwoColumnRight , PdfName . TwoPageLeft , PdfName . TwoPageRight ) ) ) ;
85
99
100
+ /// <summary>
101
+ /// Create
102
+ /// <see cref="PdfCatalog"/>
103
+ /// dictionary.
104
+ /// </summary>
105
+ /// <param name="pdfObject">the dictionary to be wrapped</param>
86
106
protected internal PdfCatalog ( PdfDictionary pdfObject )
87
107
: base ( pdfObject ) {
88
108
if ( pdfObject == null ) {
@@ -94,16 +114,38 @@ protected internal PdfCatalog(PdfDictionary pdfObject)
94
114
pageTree = new PdfPagesTree ( this ) ;
95
115
}
96
116
117
+ /// <summary>
118
+ /// Create
119
+ /// <see cref="PdfCatalog"/>
120
+ /// to
121
+ /// <see cref="PdfDocument"/>.
122
+ /// </summary>
123
+ /// <param name="pdfDocument">
124
+ /// A
125
+ /// <see cref="PdfDocument"/>
126
+ /// object representing the document
127
+ /// to which redaction applies
128
+ /// </param>
97
129
protected internal PdfCatalog ( PdfDocument pdfDocument )
98
130
: this ( ( PdfDictionary ) new PdfDictionary ( ) . MakeIndirect ( pdfDocument ) ) {
99
131
}
100
132
101
133
/// <summary>Use this method to get the <b>Optional Content Properties Dictionary</b>.</summary>
102
134
/// <remarks>
103
135
/// Use this method to get the <b>Optional Content Properties Dictionary</b>.
104
- /// Note that if you call this method, then the PdfDictionary with OCProperties will be
105
- /// generated from PdfOCProperties object right before closing the PdfDocument,
106
- /// so if you want to make low-level changes in Pdf structures themselves (PdfArray, PdfDictionary, etc),
136
+ /// Note that if you call this method, then the
137
+ /// <see cref="PdfDictionary"/>
138
+ /// with OCProperties will be
139
+ /// generated from
140
+ /// <see cref="iText.Kernel.Pdf.Layer.PdfOCProperties"/>
141
+ /// object right before closing the
142
+ /// <see cref="PdfDocument"/>
143
+ /// ,
144
+ /// so if you want to make low-level changes in Pdf structures themselves (
145
+ /// <see cref="PdfArray"/>
146
+ /// ,
147
+ /// <see cref="PdfDictionary"/>
148
+ /// , etc),
107
149
/// then you should address directly those objects, e.g.:
108
150
/// <c>
109
151
/// PdfCatalog pdfCatalog = pdfDoc.getCatalog();
@@ -140,6 +182,12 @@ public virtual PdfOCProperties GetOCProperties(bool createIfNotExists) {
140
182
return ocProperties ;
141
183
}
142
184
185
+ /// <summary>
186
+ /// Get
187
+ /// <see cref="PdfDocument"/>
188
+ /// with indirect reference associated with the object.
189
+ /// </summary>
190
+ /// <returns>the resultant dictionary</returns>
143
191
public virtual PdfDocument GetDocument ( ) {
144
192
return GetPdfObject ( ) . GetIndirectReference ( ) . GetDocument ( ) ;
145
193
}
@@ -151,14 +199,46 @@ public override void Flush() {
151
199
logger . Warn ( "PdfCatalog cannot be flushed manually" ) ;
152
200
}
153
201
202
+ /// <summary>A value specifying a destination that shall be displayed when the document is opened.</summary>
203
+ /// <remarks>
204
+ /// A value specifying a destination that shall be displayed when the document is opened.
205
+ /// See ISO 32000-1, Table 28 – Entries in the catalog dictionary.
206
+ /// </remarks>
207
+ /// <param name="destination">
208
+ /// instance of
209
+ /// <see cref="iText.Kernel.Pdf.Navigation.PdfDestination"/>.
210
+ /// </param>
211
+ /// <returns>destination</returns>
154
212
public virtual iText . Kernel . Pdf . PdfCatalog SetOpenAction ( PdfDestination destination ) {
155
213
return Put ( PdfName . OpenAction , destination . GetPdfObject ( ) ) ;
156
214
}
157
215
216
+ /// <summary>A value specifying an action that shall be performed when the document is opened.</summary>
217
+ /// <remarks>
218
+ /// A value specifying an action that shall be performed when the document is opened.
219
+ /// See ISO 32000-1, Table 28 – Entries in the catalog dictionary.
220
+ /// </remarks>
221
+ /// <param name="action">
222
+ /// instance of
223
+ /// <see cref="iText.Kernel.Pdf.Action.PdfAction"/>.
224
+ /// </param>
225
+ /// <returns>action</returns>
158
226
public virtual iText . Kernel . Pdf . PdfCatalog SetOpenAction ( PdfAction action ) {
159
227
return Put ( PdfName . OpenAction , action . GetPdfObject ( ) ) ;
160
228
}
161
229
230
+ /// <summary>The actions that shall be taken in response to various trigger events affecting the document as a whole.
231
+ /// </summary>
232
+ /// <remarks>
233
+ /// The actions that shall be taken in response to various trigger events affecting the document as a whole.
234
+ /// See ISO 32000-1, Table 28 – Entries in the catalog dictionary.
235
+ /// </remarks>
236
+ /// <param name="key">the key of which the associated value needs to be returned</param>
237
+ /// <param name="action">
238
+ /// instance of
239
+ /// <see cref="iText.Kernel.Pdf.Action.PdfAction"/>.
240
+ /// </param>
241
+ /// <returns>additional action</returns>
162
242
public virtual iText . Kernel . Pdf . PdfCatalog SetAdditionalAction ( PdfName key , PdfAction action ) {
163
243
PdfAction . SetAdditionalAction ( this , key , action ) ;
164
244
return this ;
@@ -190,6 +270,11 @@ public virtual iText.Kernel.Pdf.PdfCatalog SetPageMode(PdfName pageMode) {
190
270
return this ;
191
271
}
192
272
273
+ /// <summary>Get page mode of the document.</summary>
274
+ /// <returns>
275
+ /// current instance of
276
+ /// <see cref="PdfCatalog"/>
277
+ /// </returns>
193
278
public virtual PdfName GetPageMode ( ) {
194
279
return GetPdfObject ( ) . GetAsName ( PdfName . PageMode ) ;
195
280
}
@@ -208,6 +293,8 @@ public virtual iText.Kernel.Pdf.PdfCatalog SetPageLayout(PdfName pageLayout) {
208
293
return this ;
209
294
}
210
295
296
+ /// <summary>Get page layout of the document.</summary>
297
+ /// <returns>name object of page layout that shall be used when document is opened</returns>
211
298
public virtual PdfName GetPageLayout ( ) {
212
299
return GetPdfObject ( ) . GetAsName ( PdfName . PageLayout ) ;
213
300
}
@@ -229,6 +316,8 @@ public virtual iText.Kernel.Pdf.PdfCatalog SetViewerPreferences(PdfViewerPrefere
229
316
return Put ( PdfName . ViewerPreferences , preferences . GetPdfObject ( ) ) ;
230
317
}
231
318
319
+ /// <summary>Get viewer preferences of the document.</summary>
320
+ /// <returns>dictionary of viewer preferences</returns>
232
321
public virtual PdfViewerPreferences GetViewerPreferences ( ) {
233
322
PdfDictionary viewerPreferences = GetPdfObject ( ) . GetAsDictionary ( PdfName . ViewerPreferences ) ;
234
323
if ( viewerPreferences != null ) {
@@ -285,10 +374,25 @@ public virtual void SetLang(PdfString lang) {
285
374
Put ( PdfName . Lang , lang ) ;
286
375
}
287
376
377
+ /// <summary>Get natural language.</summary>
378
+ /// <returns>natural language</returns>
288
379
public virtual PdfString GetLang ( ) {
289
380
return GetPdfObject ( ) . GetAsString ( PdfName . Lang ) ;
290
381
}
291
382
383
+ /// <summary>
384
+ /// Add an extensions dictionary containing developer prefix identification and version
385
+ /// numbers for developer extensions that occur in this document.
386
+ /// </summary>
387
+ /// <remarks>
388
+ /// Add an extensions dictionary containing developer prefix identification and version
389
+ /// numbers for developer extensions that occur in this document.
390
+ /// See ISO 32000-1, Table 28 – Entries in the catalog dictionary.
391
+ /// </remarks>
392
+ /// <param name="extension">
393
+ /// enables developers to identify their own extension
394
+ /// relative to a base version of PDF
395
+ /// </param>
292
396
public virtual void AddDeveloperExtension ( PdfDeveloperExtension extension ) {
293
397
PdfDictionary extensions = GetPdfObject ( ) . GetAsDictionary ( PdfName . Extensions ) ;
294
398
if ( extensions == null ) {
@@ -347,12 +451,23 @@ public virtual iText.Kernel.Pdf.PdfCatalog SetCollection(PdfCollection collectio
347
451
return this ;
348
452
}
349
453
454
+ /// <summary>
455
+ /// Add key and value to
456
+ /// <see cref="PdfCatalog"/>
457
+ /// dictionary.
458
+ /// </summary>
459
+ /// <param name="key">the dictionary key corresponding with the PDF object</param>
460
+ /// <param name="value">the value of key</param>
461
+ /// <returns>the key and value</returns>
350
462
public virtual iText . Kernel . Pdf . PdfCatalog Put ( PdfName key , PdfObject value ) {
351
463
GetPdfObject ( ) . Put ( key , value ) ;
352
464
SetModified ( ) ;
353
465
return this ;
354
466
}
355
467
468
+ /// <summary>Remove key from catalog dictionary.</summary>
469
+ /// <param name="key">the dictionary key corresponding with the PDF object</param>
470
+ /// <returns>the key</returns>
356
471
public virtual iText . Kernel . Pdf . PdfCatalog Remove ( PdfName key ) {
357
472
GetPdfObject ( ) . Remove ( key ) ;
358
473
SetModified ( ) ;
@@ -459,7 +574,7 @@ internal virtual bool IsOutlineMode() {
459
574
}
460
575
461
576
/// <summary>This method removes all outlines associated with a given page</summary>
462
- /// <param name="page"/ >
577
+ /// <param name="page">the page to remove outlines</param >
463
578
internal virtual void RemoveOutlines ( PdfPage page ) {
464
579
if ( GetDocument ( ) . GetWriter ( ) == null ) {
465
580
return ;
@@ -477,7 +592,7 @@ internal virtual void RemoveOutlines(PdfPage page) {
477
592
}
478
593
479
594
/// <summary>This method sets the root outline element in the catalog.</summary>
480
- /// <param name="outline"/ >
595
+ /// <param name="outline">the outline dictionary that shall be the root of the document’s outline hierarchy</param >
481
596
internal virtual void AddRootOutline ( PdfOutline outline ) {
482
597
if ( ! outlineMode ) {
483
598
return ;
0 commit comments