Class PdfHandler

java.lang.Object
io.goobi.viewer.controller.imaging.PdfHandler

public class PdfHandler extends Object
Handles PDF generation and delivery requests, coordinating with the ContentServer PDF service.
Author:
Florian Alpers
  • Constructor Details

    • PdfHandler

      public PdfHandler(WatermarkHandler watermarkHandler, Configuration configuration)
      Creates a new PdfHandler instance.
      Parameters:
      watermarkHandler - handler used to add footer/watermark parameters
      configuration - viewer configuration supplying the IIIF API base URL
    • PdfHandler

      public PdfHandler(WatermarkHandler watermarkHandler, AbstractApiUrlManager urls)
      Creates a new PdfHandler instance.
      Parameters:
      watermarkHandler - handler used to add footer/watermark parameters
      urls - API URL manager used to build PDF download URLs
  • Method Details

    • getPdfUrl

      public String getPdfUrl(StructElement doc, PhysicalElement page)
      Return the pdf-download url for the given StructElement and PhysicalElement.
      Parameters:
      doc - struct element providing the logical section identifier
      page - physical page whose image file is included in the PDF
      Returns:
      the PDF download URL for the given struct element and single page
    • getPdfUrl

      public String getPdfUrl(StructElement se, PhysicalElement[] pages)
      Return the pdf-download url for the given StructElement and a number of PhysicalElements.
      Parameters:
      se - struct element providing the logical section identifier
      pages - array of physical pages whose image files are included in the PDF
      Returns:
      the PDF download URL for the given struct element and set of pages
    • getPdfUrl

      public String getPdfUrl(String pi, String filename)
      Returns an existing pdf file from the media folder.
      Parameters:
      pi - persistent identifier of the record
      filename - name of the existing PDF file in the media folder
      Returns:
      the URL to the existing PDF file in the media folder
    • getPdfUrl

      Gets the url to the pdf for the given StructElement. The pi is the one of the topStruct element of the given StructElement
      Parameters:
      doc - struct element determining the scope and PI of the PDF
      label - The name for the output file (.pdf-extension excluded). If this is null or empty, the label will be generated from pi and divId
      Returns:
      the PDF download URL for the given struct element
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • getPdfUrl

      Gets the url to the pdf for the given pi and divId.
      Parameters:
      doc - struct element used to determine if a divID should be appended
      pi - PI of the process from which to build pdf. Must be provided
      label - The name for the output file (.pdf-extension excluded). If this is null or empty, the label will be generated from pi and divId
      Returns:
      the PDF download URL for the given PI, struct element, and label
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • getPdfUrl

      public String getPdfUrl(String pi, Optional<String> divID, Optional<String> label)
      Returns the url to a PDF build from the mets file for the given pi.
      Parameters:
      pi - persistent identifier of the record
      divID - optional logical section ID to restrict the PDF to a struct element
      label - optional output filename without the .pdf extension
      Returns:
      the PDF download URL built from the METS file for the given PI
    • getWatermarkHandler

      public WatermarkHandler getWatermarkHandler()