class FilenameFooterWriter {

    public void addFooter(PDPage page, String fileName, long pageNumber) throws TaskException {
        if (addFooter) {
            try {
                String truncatedFilename = truncateIfRequired(fileName, maxWidth(page, pageNumber));
                writer.write(page, HorizontalAlign.LEFT, VerticalAlign.BOTTOM, truncatedFilename, FONT, FONT_SIZE,
                        Color.BLACK);
                writer.write(page, HorizontalAlign.RIGHT, VerticalAlign.BOTTOM, Long.toString(pageNumber),
                        FONT, FONT_SIZE, Color.BLACK);
            } catch (TaskIOException | IOException e) {
                throw new TaskException("Unable to write the page footer", e);
            }
        }
    }

    public  FilenameFooterWriter(boolean addFooter, PDDocument document);

}