Skip to content

Commit f2528a9

Browse files
AnhelinaMiText-CI
authored andcommitted
Cover several pdfa classes with documentation
DEVSIX-6677 Autoported commit. Original commit hash: [8db4d3e33]
1 parent c9dad88 commit f2528a9

File tree

5 files changed

+225
-1
lines changed

5 files changed

+225
-1
lines changed

itext/itext.pdfa/itext/pdfa/PdfADocument.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ protected override void FlushFonts() {
303303
base.FlushFonts();
304304
}
305305

306+
/// <summary>
307+
/// Sets the checker that defines the requirements of the PDF/A standard
308+
/// depending on conformance level.
309+
/// </summary>
310+
/// <param name="conformanceLevel">
311+
///
312+
/// <see cref="iText.Kernel.Pdf.PdfAConformanceLevel"/>
313+
/// </param>
306314
protected internal virtual void SetChecker(PdfAConformanceLevel conformanceLevel) {
307315
switch (conformanceLevel.GetPart()) {
308316
case "1": {
@@ -322,6 +330,7 @@ protected internal virtual void SetChecker(PdfAConformanceLevel conformanceLevel
322330
}
323331
}
324332

333+
/// <summary>Initializes tagStructureContext to track necessary information of document's tag structure.</summary>
325334
protected override void InitTagStructureContext() {
326335
tagStructureContext = new TagStructureContext(this, GetPdfVersionForPdfA(checker.GetConformanceLevel()));
327336
}

itext/itext.pdfa/itext/pdfa/checker/PdfA1Checker.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ protected internal override void CheckPdfString(PdfString @string) {
560560
}
561561
}
562562

563+
/// <summary>Returns maximum allowed bytes length of the string in a PDF document.</summary>
564+
/// <returns>maximum string length</returns>
563565
protected internal virtual int GetMaxStringLength() {
564566
return 65535;
565567
}
@@ -731,6 +733,27 @@ protected internal override void CheckTrailer(PdfDictionary trailer) {
731733
}
732734
}
733735

736+
/// <summary>
737+
/// Gets a
738+
/// <see cref="iText.Kernel.Pdf.PdfArray"/>
739+
/// of fields with kids from a
740+
/// <see cref="iText.Kernel.Pdf.PdfArray"/>
741+
/// of
742+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
743+
/// objects.
744+
/// </summary>
745+
/// <param name="array">
746+
/// the
747+
/// <see cref="iText.Kernel.Pdf.PdfArray"/>
748+
/// of form fields
749+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
750+
/// objects
751+
/// </param>
752+
/// <returns>
753+
/// the
754+
/// <see cref="iText.Kernel.Pdf.PdfArray"/>
755+
/// of form fields
756+
/// </returns>
734757
protected internal virtual PdfArray GetFormFields(PdfArray array) {
735758
PdfArray fields = new PdfArray();
736759
foreach (PdfObject field in array) {

itext/itext.pdfa/itext/pdfa/checker/PdfA2Checker.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,24 @@ protected internal override void CheckFormXObject(PdfStream form) {
833833
CheckFormXObject(form, null);
834834
}
835835

836+
/// <summary>
837+
/// Verify the conformity of the Form XObject with appropriate
838+
/// specification.
839+
/// </summary>
840+
/// <remarks>
841+
/// Verify the conformity of the Form XObject with appropriate
842+
/// specification. Throws PdfAConformanceException if any discrepancy was found
843+
/// </remarks>
844+
/// <param name="form">
845+
/// the
846+
/// <see cref="iText.Kernel.Pdf.PdfStream"/>
847+
/// to be checked
848+
/// </param>
849+
/// <param name="contentStream">
850+
/// the
851+
/// <see cref="iText.Kernel.Pdf.PdfStream"/>
852+
/// current content stream
853+
/// </param>
836854
protected internal virtual void CheckFormXObject(PdfStream form, PdfStream contentStream) {
837855
if (IsAlreadyChecked(form)) {
838856
return;

itext/itext.pdfa/itext/pdfa/checker/PdfAChecker.cs

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ public abstract class PdfAChecker {
139139

140140
private bool fullCheckMode = false;
141141

142+
/// <summary>Creates a PdfAChecker with the required conformance level.</summary>
143+
/// <param name="conformanceLevel">the required conformance level</param>
142144
protected internal PdfAChecker(PdfAConformanceLevel conformanceLevel) {
143145
this.conformanceLevel = conformanceLevel;
144146
}
@@ -417,57 +419,211 @@ public abstract void CheckColorSpace(PdfColorSpace colorSpace, PdfDictionary cur
417419
/// <returns>maximum allowed number of indirect objects</returns>
418420
protected internal abstract long GetMaxNumberOfIndirectObjects();
419421

422+
/// <summary>Retrieve forbidden actions in conforming document.</summary>
423+
/// <returns>
424+
/// set of
425+
/// <see cref="iText.Kernel.Pdf.PdfName"/>
426+
/// with forbidden actions
427+
/// </returns>
420428
protected internal abstract ICollection<PdfName> GetForbiddenActions();
421429

430+
/// <summary>Retrieve allowed actions in conforming document.</summary>
431+
/// <returns>
432+
/// set of
433+
/// <see cref="iText.Kernel.Pdf.PdfName"/>
434+
/// with allowed named actions
435+
/// </returns>
422436
protected internal abstract ICollection<PdfName> GetAllowedNamedActions();
423437

438+
/// <summary>Checks if the action is allowed.</summary>
439+
/// <param name="action">to be checked</param>
424440
protected internal abstract void CheckAction(PdfDictionary action);
425441

442+
/// <summary>Verify the conformity of the annotation dictionary.</summary>
443+
/// <param name="annotDic">
444+
/// the annotation
445+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
446+
/// to be checked
447+
/// </param>
426448
protected internal abstract void CheckAnnotation(PdfDictionary annotDic);
427449

450+
/// <summary>Checks if entries in catalog dictionary are valid.</summary>
451+
/// <param name="catalogDict">
452+
/// the catalog
453+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
454+
/// to be checked
455+
/// </param>
428456
protected internal abstract void CheckCatalogValidEntries(PdfDictionary catalogDict);
429457

458+
/// <summary>Verify the conformity of used color spaces.</summary>
430459
protected internal abstract void CheckColorsUsages();
431460

461+
/// <summary>Verify the conformity of the given image.</summary>
462+
/// <param name="image">the image to check</param>
463+
/// <param name="currentColorSpaces">
464+
/// the
465+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
466+
/// containing the color spaces used in the document
467+
/// </param>
432468
protected internal abstract void CheckImage(PdfStream image, PdfDictionary currentColorSpaces);
433469

470+
/// <summary>Verify the conformity of the file specification dictionary.</summary>
471+
/// <param name="fileSpec">
472+
/// the
473+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
474+
/// containing file specification to be checked
475+
/// </param>
434476
protected internal abstract void CheckFileSpec(PdfDictionary fileSpec);
435477

478+
/// <summary>Verify the conformity of the form dictionary.</summary>
479+
/// <param name="form">
480+
/// the form
481+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
482+
/// to be checked
483+
/// </param>
436484
protected internal abstract void CheckForm(PdfDictionary form);
437485

486+
/// <summary>Verify the conformity of the form XObject dictionary.</summary>
487+
/// <param name="form">
488+
/// the
489+
/// <see cref="iText.Kernel.Pdf.PdfStream"/>
490+
/// to check
491+
/// </param>
438492
protected internal abstract void CheckFormXObject(PdfStream form);
439493

494+
/// <summary>Performs a number of checks on the logical structure of the document.</summary>
495+
/// <param name="catalog">
496+
/// the catalog
497+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
498+
/// to check
499+
/// </param>
440500
protected internal abstract void CheckLogicalStructure(PdfDictionary catalog);
441501

502+
/// <summary>Performs a number of checks on the metadata of the document.</summary>
503+
/// <param name="catalog">
504+
/// the catalog
505+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
506+
/// to check
507+
/// </param>
442508
protected internal abstract void CheckMetaData(PdfDictionary catalog);
443509

510+
/// <summary>Verify the conformity of the non-symbolic TrueType font.</summary>
511+
/// <param name="trueTypeFont">
512+
/// the
513+
/// <see cref="iText.Kernel.Font.PdfTrueTypeFont"/>
514+
/// to check
515+
/// </param>
444516
protected internal abstract void CheckNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont);
445517

518+
/// <summary>Verify the conformity of the output intents array in the catalog dictionary.</summary>
519+
/// <param name="catalog">
520+
/// the
521+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
522+
/// to check
523+
/// </param>
446524
protected internal abstract void CheckOutputIntents(PdfDictionary catalog);
447525

526+
/// <summary>Verify the conformity of the page dictionary.</summary>
527+
/// <param name="page">
528+
/// the
529+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
530+
/// to check
531+
/// </param>
532+
/// <param name="pageResources">the page's resources dictionary</param>
448533
protected internal abstract void CheckPageObject(PdfDictionary page, PdfDictionary pageResources);
449534

535+
/// <summary>Checks the allowable size of the page.</summary>
536+
/// <param name="page">
537+
/// the
538+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
539+
/// of page which size being checked
540+
/// </param>
450541
protected internal abstract void CheckPageSize(PdfDictionary page);
451542

543+
/// <summary>Verify the conformity of the PDF array.</summary>
544+
/// <param name="array">
545+
/// the
546+
/// <see cref="iText.Kernel.Pdf.PdfArray"/>
547+
/// to check
548+
/// </param>
452549
protected internal abstract void CheckPdfArray(PdfArray array);
453550

551+
/// <summary>Verify the conformity of the PDF dictionary.</summary>
552+
/// <param name="dictionary">
553+
/// the
554+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
555+
/// to check
556+
/// </param>
454557
protected internal abstract void CheckPdfDictionary(PdfDictionary dictionary);
455558

559+
/// <summary>Verify the conformity of the PDF name.</summary>
560+
/// <param name="name">
561+
/// the
562+
/// <see cref="iText.Kernel.Pdf.PdfName"/>
563+
/// to check
564+
/// </param>
456565
protected internal abstract void CheckPdfName(PdfName name);
457566

567+
/// <summary>Verify the conformity of the PDF number.</summary>
568+
/// <param name="number">
569+
/// the
570+
/// <see cref="iText.Kernel.Pdf.PdfNumber"/>
571+
/// to check
572+
/// </param>
458573
protected internal abstract void CheckPdfNumber(PdfNumber number);
459574

575+
/// <summary>Verify the conformity of the PDF stream.</summary>
576+
/// <param name="stream">
577+
/// the
578+
/// <see cref="iText.Kernel.Pdf.PdfStream"/>
579+
/// to check
580+
/// </param>
460581
protected internal abstract void CheckPdfStream(PdfStream stream);
461582

583+
/// <summary>Verify the conformity of the PDF string.</summary>
584+
/// <param name="string">
585+
/// the
586+
/// <see cref="iText.Kernel.Pdf.PdfString"/>
587+
/// to check
588+
/// </param>
462589
protected internal abstract void CheckPdfString(PdfString @string);
463590

591+
/// <summary>Verify the conformity of the symbolic TrueType font.</summary>
592+
/// <param name="trueTypeFont">
593+
/// the
594+
/// <see cref="iText.Kernel.Font.PdfTrueTypeFont"/>
595+
/// to check
596+
/// </param>
464597
protected internal abstract void CheckSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont);
465598

599+
/// <summary>Verify the conformity of the trailer dictionary.</summary>
600+
/// <param name="trailer">
601+
/// the
602+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
603+
/// of trailer to check
604+
/// </param>
466605
protected internal abstract void CheckTrailer(PdfDictionary trailer);
467606

607+
/// <summary>Verify the conformity of the page transparency.</summary>
608+
/// <param name="pageDict">
609+
/// the
610+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
611+
/// contains contents for transparency to be checked
612+
/// </param>
613+
/// <param name="pageResources">
614+
/// the
615+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
616+
/// contains resources for transparency to be checked
617+
/// </param>
468618
protected internal abstract void CheckPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources
469619
);
470620

621+
/// <summary>Verify the conformity of the resources dictionary.</summary>
622+
/// <param name="resources">
623+
/// the
624+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
625+
/// to be checked
626+
/// </param>
471627
protected internal virtual void CheckResources(PdfDictionary resources) {
472628
if (resources == null) {
473629
return;
@@ -515,10 +671,21 @@ protected internal virtual void CheckResources(PdfDictionary resources) {
515671
}
516672
}
517673

674+
/// <summary>Checks if the specified flag is set.</summary>
675+
/// <param name="flags">a set of flags specifying various characteristics of the PDF object</param>
676+
/// <param name="flag">to be checked</param>
677+
/// <returns>true if the specified flag is set</returns>
518678
protected internal static bool CheckFlag(int flags, int flag) {
519679
return (flags & flag) != 0;
520680
}
521681

682+
/// <summary>Checks conformance level of PDF/A standard.</summary>
683+
/// <param name="conformanceLevel">
684+
/// the
685+
/// <see cref="iText.Kernel.Pdf.PdfAConformanceLevel"/>
686+
/// to be checked
687+
/// </param>
688+
/// <returns>true if the specified conformanceLevel is <c>a</c> for PDF/A-1, PDF/A-2 or PDF/A-3</returns>
522689
protected internal static bool CheckStructure(PdfAConformanceLevel conformanceLevel) {
523690
return conformanceLevel == PdfAConformanceLevel.PDF_A_1A || conformanceLevel == PdfAConformanceLevel.PDF_A_2A
524691
|| conformanceLevel == PdfAConformanceLevel.PDF_A_3A;
@@ -543,6 +710,13 @@ protected internal static bool IsContainsTransparencyGroup(PdfDictionary diction
543710
.Group).GetAsName(PdfName.S));
544711
}
545712

713+
/// <summary>Checks whether the specified dictionary was already checked.</summary>
714+
/// <param name="dictionary">
715+
/// the
716+
/// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
717+
/// to check
718+
/// </param>
719+
/// <returns>true if the specified dictionary was checked</returns>
546720
protected internal virtual bool IsAlreadyChecked(PdfDictionary dictionary) {
547721
if (checkedObjects.Contains(dictionary)) {
548722
return true;

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1ff59d8beedac800465af145deba0d0ad5664382
1+
8db4d3e33a42e02dd631c24a1d7c216ef46ecf53

0 commit comments

Comments
 (0)