PageRenderTime 43ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 183 lines | 17 code | 13 blank | 153 comment | 0 complexity | c96038f25cd47a98cc73568d098c4bc0 MD5 | raw file
  1. /*
  2. * $Id: PdfPageEvent.java 4141 2009-12-05 19:01:18Z psoares33 $
  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. import com.itextpdf.text.Document;
  46. import com.itextpdf.text.Paragraph;
  47. import com.itextpdf.text.Rectangle;
  48. /**
  49. * Allows a class to catch several document events.
  50. *<p>
  51. * Note: do not use Document.add() inside a page event.
  52. *
  53. * @author Paulo Soares
  54. */
  55. public interface PdfPageEvent {
  56. /**
  57. * Called when the document is opened.
  58. *
  59. * @param writer the <CODE>PdfWriter</CODE> for this document
  60. * @param document the document
  61. */
  62. public void onOpenDocument(PdfWriter writer, Document document);
  63. /**
  64. * Called when a page is initialized.
  65. * <P>
  66. * Note that if even if a page is not written this method is still
  67. * called. It is preferable to use <CODE>onEndPage</CODE> to avoid
  68. * infinite loops.
  69. *
  70. * @param writer the <CODE>PdfWriter</CODE> for this document
  71. * @param document the document
  72. */
  73. public void onStartPage(PdfWriter writer, Document document);
  74. /**
  75. * Called when a page is finished, just before being written to the document.
  76. *
  77. * @param writer the <CODE>PdfWriter</CODE> for this document
  78. * @param document the document
  79. */
  80. public void onEndPage(PdfWriter writer, Document document);
  81. /**
  82. * Called when the document is closed.
  83. * <P>
  84. * Note that this method is called with the page number equal
  85. * to the last page plus one.
  86. *
  87. * @param writer the <CODE>PdfWriter</CODE> for this document
  88. * @param document the document
  89. */
  90. public void onCloseDocument(PdfWriter writer, Document document);
  91. /**
  92. * Called when a Paragraph is written.
  93. * <P>
  94. * <CODE>paragraphPosition</CODE> will hold the height at which the
  95. * paragraph will be written to. This is useful to insert bookmarks with
  96. * more control.
  97. *
  98. * @param writer the <CODE>PdfWriter</CODE> for this document
  99. * @param document the document
  100. * @param paragraphPosition the position the paragraph will be written to
  101. */
  102. public void onParagraph(PdfWriter writer, Document document, float paragraphPosition);
  103. /**
  104. * Called when a Paragraph is written.
  105. * <P>
  106. * <CODE>paragraphPosition</CODE> will hold the height of the end of the paragraph.
  107. *
  108. * @param writer the <CODE>PdfWriter</CODE> for this document
  109. * @param document the document
  110. * @param paragraphPosition the position of the end of the paragraph
  111. */
  112. public void onParagraphEnd(PdfWriter writer,Document document,float paragraphPosition);
  113. /**
  114. * Called when a Chapter is written.
  115. * <P>
  116. * <CODE>position</CODE> will hold the height at which the
  117. * chapter will be written to.
  118. *
  119. * @param writer the <CODE>PdfWriter</CODE> for this document
  120. * @param document the document
  121. * @param paragraphPosition the position the chapter will be written to
  122. * @param title the title of the Chapter
  123. */
  124. public void onChapter(PdfWriter writer,Document document,float paragraphPosition, Paragraph title);
  125. /**
  126. * Called when the end of a Chapter is reached.
  127. * <P>
  128. * <CODE>position</CODE> will hold the height of the end of the chapter.
  129. *
  130. * @param writer the <CODE>PdfWriter</CODE> for this document
  131. * @param document the document
  132. * @param paragraphPosition the position the chapter will be written to
  133. */
  134. public void onChapterEnd(PdfWriter writer,Document document,float paragraphPosition);
  135. /**
  136. * Called when a Section is written.
  137. * <P>
  138. * <CODE>position</CODE> will hold the height at which the
  139. * section will be written to.
  140. *
  141. * @param writer the <CODE>PdfWriter</CODE> for this document
  142. * @param document the document
  143. * @param paragraphPosition the position the section will be written to
  144. * @param depth the number depth of the section
  145. * @param title the title of the section
  146. */
  147. public void onSection(PdfWriter writer,Document document,float paragraphPosition, int depth, Paragraph title);
  148. /**
  149. * Called when the end of a Section is reached.
  150. * <P>
  151. * <CODE>position</CODE> will hold the height of the section end.
  152. *
  153. * @param writer the <CODE>PdfWriter</CODE> for this document
  154. * @param document the document
  155. * @param paragraphPosition the position the section will be written to
  156. */
  157. public void onSectionEnd(PdfWriter writer,Document document,float paragraphPosition);
  158. /**
  159. * Called when a <CODE>Chunk</CODE> with a generic tag is written.
  160. * <P>
  161. * It is useful to pinpoint the <CODE>Chunk</CODE> location to generate
  162. * bookmarks, for example.
  163. *
  164. * @param writer the <CODE>PdfWriter</CODE> for this document
  165. * @param document the document
  166. * @param rect the <CODE>Rectangle</CODE> containing the <CODE>Chunk</CODE>
  167. * @param text the text of the tag
  168. */
  169. public void onGenericTag(PdfWriter writer, Document document, Rectangle rect, String text);
  170. }