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.

PDFLaunch.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. * 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. /**
  19. * This class represents the /Launch action.
  20. */
  21. public class PDFLaunch extends PDFAction {
  22. private PDFFileSpec externalFileSpec;
  23. public PDFLaunch(PDFFileSpec fileSpec) {
  24. this.externalFileSpec = fileSpec;
  25. }
  26. public String getAction() {
  27. return this.referencePDF();
  28. }
  29. public String toPDFString() {
  30. StringBuffer sb = new StringBuffer(64);
  31. sb.append(getObjectID());
  32. sb.append("<<\n/S /Launch\n/F ");
  33. sb.append(externalFileSpec.referencePDF());
  34. sb.append(" \n>>\nendobj\n");
  35. return sb.toString();
  36. }
  37. /**
  38. * Check if this equals another object.
  39. *
  40. * @param obj the object to compare
  41. * @return true if this equals other object
  42. */
  43. public boolean equals(Object obj) {
  44. if (this == obj) {
  45. return true;
  46. }
  47. if (obj == null || !(obj instanceof PDFLaunch)) {
  48. return false;
  49. }
  50. PDFLaunch launch = (PDFLaunch) obj;
  51. if (!launch.externalFileSpec.referencePDF().equals(externalFileSpec.referencePDF())) {
  52. return false;
  53. }
  54. return true;
  55. }
  56. }