Thanks for contacting support.
You can determine the byte size/range of complete document by loading it into ByteArrayInputStream but in order to load a single page in memory, you can generate a new document in memory with particular/desired page(s) from large input file(s) and then load the new generated document into memory. This way the memory bytes will only contain the bytes of that particular page or set of page(s).
Please check following code snippet to achieve the single page in bytes and supply those bytes for further processing. Here I supplied bytes just to show the count of pages in new generated document.
Document doc = new Document(dataDir + “input.pdf”); Document doc2 = new Document(); doc2.getPages().add(doc.getPages().get_Item(1)); ByteArrayOutputStream dstStream = new ByteArrayOutputStream(); doc2.save(dstStream); ByteArrayInputStream srcStream = new ByteArrayInputStream(dstStream.toByteArray()); // Supply bytes of particular page doc2 = new Document(srcStream);
In case if you need any further assistance, please feel free to contact us.
Thanks guys. I was referring to the just loading the bytes for the page (along with maybe the linearized dictionary). I was afraid that it wasn’t possible. We’ll explore other routes. Thanks again for the reply!