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 2.1KB

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