Loading Byte() Directly into PDF Control  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Loading Byte() Directly into PDF Control

Post by Lambchop »

Gentle Folks -
I am trying to confirm that there is no function available for me to load a Byte() directly into the PDF control? In effect, I want to pass a memory stream directly as an object into the editor control. It would look something like this ...
pdfCtl.OpenDocFrom(myBytes())
I know that there is a class in the Full Demo called IStreamWrapper which takes a FileStream object and converts into a generic Stream object then reads it. I can convert the Byte() into a memory stream but this seems redundant since your IStreamWrapper wants to put the filestream object into a byte array.
I have read another Tracker post from 2020 that stated why you don't want to use a memory stream directly because of concern for exceeding memory. However, I completely disagree with this logic as database objects must be loaded into memory in full chunks so the concern from Tracker forces 2x the overhead for memory management which contradicts the technical argument against using memory streams directly.
As of right now, I am forced to pull the PDF from my database, write it to a temporary file on the hard disk, read it from the hard disk and load it back into memory for the PDF control to display. This requires extensive garbage collection that is unnecessary just so that the tracker control can read 1 byte at a time. It is also very processor intensive with so much read/write.
In summary, I agree completely with the original concern for memory management and huge PDF files. However, hardware has advanced considerably and security has locked down the ability to efficiently read/write temporary files. If I already have a file object converted to a Byte(), then please advise as to what change you recommend to the IStreamWrapper class to avoid using a FileStream and use the Byte() directly.
Many Thanks! -Eric
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Loading Byte() Directly into PDF Control  SOLVED

Post by Vasyl-Tracker Dev Team »

Hi Lambchop.

There is only one way currently: you can create your own implementation of IStreamWrapper-object that accesses to an existing memory-block and reads it directly through the implemented IStream-methods.

Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply