Java 类com.itextpdf.text.pdf.RandomAccessFileOrArray 实例源码

项目:sejda-itext5    文件:DefaultPdfSourceOpener.java   
private PdfReader doOpen(RandomAccessSource ras, byte[] pwd) throws TaskIOException, IOException {
    PdfReader reader;
    try {
        reader = new PdfReader(new RandomAccessFileOrArray(ras), pwd);
    } catch (BadPasswordException bpe) {
        throw new TaskWrongPasswordException("Unable to open the document due to a wrong password.", bpe);
    }

    reader.removeUnusedObjects();
    reader.consolidateNamedDestinations();
    return reader;
}
项目:dli-downloader    文件:TiffToPDFConverter.java   
private static void close1(RandomAccessFileOrArray myTiffFile) {
    if (myTiffFile != null) {
        try {
            myTiffFile.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
项目:testarea-itext5    文件:SignatureExtractor.java   
public SignatureExtractor(File file) throws IOException
{
    this(new PdfReader(new RandomAccessFileOrArray(file.getPath()), null));
}
项目:testarea-itext5    文件:OpenFile.java   
/**
 * <a href="https://stackoverflow.com/questions/46663640/itext-pdf-fails-with-message-dictionary-key-endstream-is-not-a-name">
 * iText PDF fails with message “Dictionary key endstream is not a name”
 * </a>
 * <br/>
 * <a href="https://www.dropbox.com/s/xz77curzkigod0k/itext_banner_InvalidPdfException.pdf">
 * itext_banner_InvalidPdfException.pdf
 * </a>
 * <p>
 * There is a syntax error inside one of the objects of the PDF.
 * As this object is referenced from no other object, though, it
 * is ignored if the PDF is read in partial mode.
 * </p>
 */
@Test
public void testItextBannerInvalidPdfException() throws IOException
{
    try ( InputStream resource = getClass().getResourceAsStream("itext_banner_InvalidPdfException.pdf") )
    {
        PdfReader pdfReader = new PdfReader(new RandomAccessFileOrArray(resource), null);
        Assert.assertEquals("", "GraphicsMagick 1.3.26 2017-07-04 Q16 http://www.GraphicsMagick.org/", pdfReader.getInfo().get("Producer"));
    }
}