All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sejda.impl.itext.component.PdfCopier Maven / Gradle / Ivy

/*
 * Created on 03/jul/2011
 *
 * Copyright 2010 by Andrea Vacondio ([email protected]).
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */
package org.sejda.impl.itext.component;

import java.io.Closeable;
import java.util.List;
import java.util.Map;

import org.sejda.model.exception.TaskException;
import org.sejda.model.exception.TaskIOException;

import com.lowagie.text.pdf.PdfPageLabels;
import com.lowagie.text.pdf.PdfReader;

/**
 * Provides functionalities to copy pages from a given {@link PdfReader}.
 * 
 * @author Andrea Vacondio
 * 
 */
public interface PdfCopier extends Closeable {

    /**
     * Adds the given page extracted from the input reader.
     * 
     * @param reader
     * @param pageNumber
     * @throws TaskException
     */
    void addPage(PdfReader reader, int pageNumber) throws TaskException;

    /**
     * Adds all the pages from the input reader
     * 
     * @param reader
     * @throws TaskException
     */
    void addAllPages(PdfReader reader) throws TaskException;

    /**
     * Adds a blank page to the current underlying document.
     * 
     * @param reader
     *            the reader to use to get page size and rotation.
     */
    void addBlankPage(PdfReader reader);

    /**
     * Adds a blank page to the current underlying document if the total number of written pages is odd.
     * 
     * @param reader
     *            the reader to use to get page size and rotation.
     */
    void addBlankPageIfOdd(PdfReader reader);

    /**
     * Enables compression of the xref streams if compress is true.
     * 
     * @param compress
     */
    void setCompression(boolean compress);

    /**
     * sets the input page labels to the underlying pdf copy.
     * 
     * @param labels
     */
    void setPageLabels(PdfPageLabels labels);

    /**
     * Frees the reader on the underlying pdf copy.
     * 
     * @param reader
     * @throws TaskIOException
     */
    void freeReader(PdfReader reader) throws TaskIOException;

    /**
     * Sets the outline on the document generated by this copier.
     * 
     * @param outline
     */
    void setOutline(List> outline);

    /**
     * @return the number of pages this copier has copied
     */
    int getNumberOfCopiedPages();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy