/projects/itext-5.0.3/core/com/itextpdf/text/pdf/PdfDeveloperExtension.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 120 lines · 28 code · 8 blank · 84 comment · 0 complexity · 5eb35afe5cfadf5b9e71e6c0fd546182 MD5 · raw file

  1. /*
  2. * $Id: Chapter.java 3373 2008-05-12 16:21:24Z xlv $
  3. *
  4. * This file is part of the iText project.
  5. * Copyright (c) 1998-2009 1T3XT BVBA
  6. * Authors: Bruno Lowagie, Paulo Soares, et al.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License version 3
  10. * as published by the Free Software Foundation with the addition of the
  11. * following permission added to Section 15 as permitted in Section 7(a):
  12. * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY 1T3XT,
  13. * 1T3XT DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  17. * or FITNESS FOR A PARTICULAR PURPOSE.
  18. * See the GNU Affero General Public License for more details.
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program; if not, see http://www.gnu.org/licenses or write to
  21. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA, 02110-1301 USA, or download the license from the following URL:
  23. * http://itextpdf.com/terms-of-use/
  24. *
  25. * The interactive user interfaces in modified source and object code versions
  26. * of this program must display Appropriate Legal Notices, as required under
  27. * Section 5 of the GNU Affero General Public License.
  28. *
  29. * In accordance with Section 7(b) of the GNU Affero General Public License,
  30. * you must retain the producer line in every PDF that is created or manipulated
  31. * using iText.
  32. *
  33. * You can be released from the requirements of the license by purchasing
  34. * a commercial license. Buying such a license is mandatory as soon as you
  35. * develop commercial activities involving the iText software without
  36. * disclosing the source code of your own applications.
  37. * These activities include: offering paid services to customers as an ASP,
  38. * serving PDFs on the fly in a web application, shipping iText with a closed
  39. * source product.
  40. *
  41. * For more information, please contact iText Software Corp. at this
  42. * address: sales@itextpdf.com
  43. */
  44. package com.itextpdf.text.pdf;
  45. /**
  46. * Beginning with BaseVersion 1.7, the extensions dictionary lets developers
  47. * designate that a given document contains extensions to PDF. The presence
  48. * of the extension dictionary in a document indicates that it may contain
  49. * developer-specific PDF properties that extend a particular base version
  50. * of the PDF specification.
  51. * The extensions dictionary enables developers to identify their own extensions
  52. * relative to a base version of PDF. Additionally, the convention identifies
  53. * extension levels relative to that base version. The intent of this dictionary
  54. * is to enable developers of PDF-producing applications to identify company-specific
  55. * specifications (such as this one) that PDF-consuming applications use to
  56. * interpret the extensions.
  57. * @since 2.1.6
  58. */
  59. public class PdfDeveloperExtension {
  60. /** An instance of this class for Adobe 1.7 Extension level 3. */
  61. public static final PdfDeveloperExtension ADOBE_1_7_EXTENSIONLEVEL3 =
  62. new PdfDeveloperExtension(PdfName.ADBE, PdfWriter.PDF_VERSION_1_7, 3);
  63. /** The prefix used in the Extensions dictionary added to the Catalog. */
  64. protected PdfName prefix;
  65. /** The base version. */
  66. protected PdfName baseversion;
  67. /** The extension level within the baseversion. */
  68. protected int extensionLevel;
  69. /**
  70. * Creates a PdfDeveloperExtension object.
  71. * @param prefix the prefix referring to the developer
  72. * @param baseversion the number of the base version
  73. * @param extensionLevel the extension level within the baseverion.
  74. */
  75. public PdfDeveloperExtension(PdfName prefix, PdfName baseversion, int extensionLevel) {
  76. this.prefix = prefix;
  77. this.baseversion = baseversion;
  78. this.extensionLevel = extensionLevel;
  79. }
  80. /**
  81. * Gets the prefix name.
  82. * @return a PdfName
  83. */
  84. public PdfName getPrefix() {
  85. return prefix;
  86. }
  87. /**
  88. * Gets the baseversion name.
  89. * @return a PdfName
  90. */
  91. public PdfName getBaseversion() {
  92. return baseversion;
  93. }
  94. /**
  95. * Gets the extension level within the baseversion.
  96. * @return an integer
  97. */
  98. public int getExtensionLevel() {
  99. return extensionLevel;
  100. }
  101. /**
  102. * Generations the developer extension dictionary corresponding
  103. * with the prefix.
  104. * @return a PdfDictionary
  105. */
  106. public PdfDictionary getDeveloperExtensions() {
  107. PdfDictionary developerextensions = new PdfDictionary();
  108. developerextensions.put(PdfName.BASEVERSION, baseversion);
  109. developerextensions.put(PdfName.EXTENSIONLEVEL, new PdfNumber(extensionLevel));
  110. return developerextensions;
  111. }
  112. }