Example usage for com.itextpdf.text Document plainRandomAccess

List of usage examples for com.itextpdf.text Document plainRandomAccess

Introduction

In this page you can find the example usage for com.itextpdf.text Document plainRandomAccess.

Prototype

boolean plainRandomAccess

To view the source code for com.itextpdf.text Document plainRandomAccess.

Click Source Link

Document

When true the file access is not done through a memory mapped file.

Usage

From source file:com.github.albfernandez.joinpdf.JoinPdf.java

License:Open Source License

private static RandomAccessSource createRamdomAccessSource(final File file) throws IOException {
    RandomAccessSource source = new RandomAccessSourceFactory().setForceRead(false)
            .setUsePlainRandomAccess(Document.plainRandomAccess).createBestSource(file.getAbsolutePath());
    return source;
}

From source file:org.h819.commons.file.MyPDFUtils.java

/**
 *  PdfReader ? pdf  pdf ???/*from   w  ww .j  a  v a2  s .  c om*/
 *
 * @param pdfFile ? pdf 
 * @return PdfReader 
 * @throws IOException
 */
public static PdfReader getPdfReader(File pdfFile) throws IOException {

    Document.plainRandomAccess = true;
    FileInputStream fileStream = new FileInputStream(pdfFile);
    return new PdfReader(
            new RandomAccessFileOrArray(new FileChannelRandomAccessSource(fileStream.getChannel())), null);

}