I’m using a generic C# wrapper to render images from PDFs after a user uploads a file and I’m wondering whether its possible to configure the wrapper to work with byte arrays rather than actual files on disk as this will save me an extra trip and increase my application’s performance. Ideally I want to pass a byte array of the PDF and have it return a byte array. I had look at the wrapper code and I can’t figure out how exactly (if even possible) I would do this. So is it possible? If so any guidance as to where I should start?
Thanks.
You can’t feed a sequence of bytes to the Ghostscript PDF interpreter, nor read back a PDF file as a sequence of bytes produced by the pdfwrite device.
The reason is simply that the PDF interpreter, and the PDF writer, both need random access to the file in order to interpret/create the file. If the whole file were held in memory then it would be possible to do so, but that would be a severe limitation on the size of files.