You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PDFAnnotList.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.pdf;
  18. // Java
  19. import java.util.List;
  20. /**
  21. * class representing an object which is a list of annotations.
  22. *
  23. * This PDF object is a list of references to /Annot objects. So far we
  24. * are dealing only with links.
  25. */
  26. public class PDFAnnotList extends PDFObject {
  27. /**
  28. * the /Annot objects
  29. */
  30. private List links = new java.util.Vector();
  31. /**
  32. * add an /Annot object of /Subtype /Link.
  33. *
  34. * @param link the PDFLink to add.
  35. */
  36. public void addAnnot(PDFObject link) {
  37. this.links.add(link);
  38. }
  39. /**
  40. * get the count of /Annot objects
  41. *
  42. * @return the number of links
  43. */
  44. public int getCount() {
  45. return this.links.size();
  46. }
  47. /**
  48. * @see org.apache.fop.pdf.PDFObject#toPDFString()
  49. */
  50. public String toPDFString() {
  51. StringBuffer p = new StringBuffer(128);
  52. p.append(getObjectID());
  53. p.append("[\n");
  54. for (int i = 0; i < getCount(); i++) {
  55. p.append(((PDFObject)links.get(i)).referencePDF());
  56. p.append("\n");
  57. }
  58. p.append("]\nendobj\n");
  59. return p.toString();
  60. }
  61. /*
  62. * example
  63. * 20 0 obj
  64. * [
  65. * 19 0 R
  66. * ]
  67. * endobj
  68. */
  69. }