Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-2591

Allow using custom Filters

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • 2.0.0
    • None

    Description

      It seems that currently FilterFactory has a hard-coded list of filters, and that there is no way for clients to modify it. This is problematic if you want to replace a built-in Filter by a custom one.

      Would this patch be appropriate?

      Index: pdfbox/src/main/java/org/apache/pdfbox/filter/FilterFactory.java
      ===================================================================
      --- pdfbox/src/main/java/org/apache/pdfbox/filter/FilterFactory.java    (revision 1650041)
      +++ pdfbox/src/main/java/org/apache/pdfbox/filter/FilterFactory.java    (working copy)
      @@ -97,6 +97,17 @@
               return filter;
           }
       
      +    /**
      +     * Set the filter instance to be used for a given filter name.
      +     * @param filterName the name of the filter to set
      +     * @param filter the filter to use for that name
      +     * @return the previous filter that was used for that name
      +     */
      +    public Filter setFilter(COSName filterName, Filter filter) {
      +       Filter previous = filters.put(filterName, filter);
      +       return previous;
      +    }
      +
           // returns all available filters, for testing
           Collection<Filter> getAllFilters()
           {
      

      Attachments

        1. PDFBOX-2591.patch
          0.8 kB
          Daniel Bonniot de Ruisselet

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dbr Daniel Bonniot de Ruisselet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: