[ 
https://issues.apache.org/jira/browse/PDFBOX-2591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14269812#comment-14269812
 ] 

John Hewson commented on PDFBOX-2591:
-------------------------------------

I was going to say the same thing - if there's an improvment we can make to 
JBIG2Filter the. It is better to make it there, then everyone can benefit from 
it.

We try to avoid allowing users to provide their own customisation to our APIs 
unless it is absolutely necessary, as it limits our ability to do internal 
refactoring and tends to encourage hacks.

> Allow using custom Filters
> --------------------------
>
>                 Key: PDFBOX-2591
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2591
>             Project: PDFBox
>          Issue Type: Improvement
>            Reporter: Daniel Bonniot de Ruisselet
>              Labels: patch
>             Fix For: 2.0.0
>
>         Attachments: PDFBOX-2591.patch
>
>
> 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?
> {noformat}
> 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()
>      {
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to