How to open PDF file using MemoryStream?

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
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,

How to open PDF file using MemoryStream?

Suppose,
I have temppath as MemoryStream and pdfcontrol as pdfctrl.
now i write,

pdfctrl.OpenDocFrom(temppath )
gives "Exception has been thrown by the target of an invocation." exception.

please give me a solution. i'm looking forward to it.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: How to open PDF file using MemoryStream?

Post by Tracker Supp-Stefan »

Hello vivekpatel,

Please make sure that you post your questions in the correct forums so that we can help you in the most efficient way!
You posted an Editor SDK question in the end user Viewer section. This is not monitored by developers, so you might get a delayed reply (or not the correct one at all)!

I will now move the topic to the correct forum so that it can be addressed properly.

Regards,
Stefan
JSantmann@Wellsoft.com
User
Posts: 9
Joined: Wed Mar 29, 2017 1:36 am

Re: How to open PDF file using MemoryStream?

Post by JSantmann@Wellsoft.com »

I have the same question.
How do you read/write the full PDF file contents of the "Editor" from/to a buffer (for example a MemoryStream)?
Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello JSantmann@Wellsoft.com,

You mean you want to open the PDF document form the buffer and save it into the buffer? For that you should pass the IStream derived class into the https://sdkhelp.pdf-xchange.com/vie ... penDocFrom
The example on how to implement the IStream interface is in our FullDemo sample project.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,

How can i do this vb.net?
i did memorystream to filestream to istream, but doesn't work.
what i have to do?
please help to open document with memorystream.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

What exactly does not work for you and what have you implemented? Have you checked the FullDemo application like I advised in my previous post?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
It is possible to open images using IStreamWrapper?
I have tried to open image file in FullDemo sample project using IStreamWrappe, which produce exception.
i'm looking forward to it.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

I have also experienced problems with this - we will investigate this.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
Did you get any solution?
i'm looking forward to it.
Thanks in advance.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

After further investigation it appeared that everything worked correctly. Please describe what exactly are you doing to reproduce this behavior. Here's my settings:
Capture1.PNG
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
I did the same.
here i'm attaching my FullDemo sample.
Attachments
FullDemo.rar
(821.35 KiB) Downloaded 110 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

Have you tried doing this on the clean FullDemo project? Or have you modified something? Also, if you can, please provide a file sample that you have troubles with.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
No there is no change in FullDemo project and i have clean and rebuild the project, but issue is there.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Then I will need your file samples and version of the dll.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
Can i get your FullDemo?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

It's the same clean FullDemo project.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,

Which dll i have to send?
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
i'm facing the file upload problem. So, i con't upload my files and dll.
what next i have to do?
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: How to open PDF file using MemoryStream?

Post by Will - Tracker Supp »

Hi Vivek,

Files need to be wrapped in a ZIP folder or 7zip/RAR archive to be uploaded.

Thanks,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
I have "PDFXEditCore.x86.dll" with version 6.0.317.1.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

Please update to the latest version.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
I have updated new version 6.0.321.0.
Still it can't open image file using IStreamWrapper.
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
Did you get any solution?
i'm looking forward to it.
Thanks in advance.
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: How to open PDF file using MemoryStream?

Post by Will - Tracker Supp »

Hi Vivek,

Yesterday was a holiday in most of Europe, as is today where Alex is. He'll take a look at this as soon as he's able, tomorrow or shortly thereafter.

**Edit** Alex was briefly in touch and has requested a sample image that you cannot open.

Thanks,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
Here i'm attaching my images.
Attachments
Desktop.rar
(1.49 MiB) Downloaded 82 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

Every one of them opened successfully:
Capture.PNG
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
on your side it's ok.
i have updated PDFXEditCore.x86.dll to 6.0.321.
is there any problem on my side?
It's not open in FullDemon that tracker provided.
what i have to do? please help me to getting out.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

I've copied the needed code from the FullDemo application and created a small project for you.

Cheers,
Alex
Attachments
OpenFileUsingMemorySteram.rar
(208.83 KiB) Downloaded 84 times
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello And Thanks,
Thanks for the demo. But Still it produce error in your demo.
Here i'm attached error image.
Attachments
Img_with_streamwap.rar
(76.27 KiB) Downloaded 89 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: How to open PDF file using MemoryStream?

Post by Tracker Supp-Stefan »

Hello Vivekpatel,

Alex is not in the office today - so he will follow up here tomorrow, but in the mean time - it seems like this is a problem with your setup.
Please take a look here:
http://stackoverflow.com/questions/4550 ... erstanding
And handle this exception so that we can get more info on what is causing it.

Regards,
Stefan
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,

You will need to use the try-catch block to handle exceptions - that's basic programming knowledge. After that you can see the exception's description.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,
I did Try.. Catch Block.
Here i'm sending my IstreamWrapper Class file to figure out prob.
Attachments
IStreamWrapper.rar
(1.13 KiB) Downloaded 86 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

Hello vivekpatel,
I did Try.. Catch Block.
And what was the error that you have caught?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vivekpatel
User
Posts: 141
Joined: Sat Aug 27, 2016 11:00 am

Re: How to open PDF file using MemoryStream?

Post by vivekpatel »

Hello,

"Exception has been thrown by the target of an invocation." , exception After IStream_Read() function.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to open PDF file using MemoryStream?

Post by Sasha - Tracker Dev Team »

"Exception has been thrown by the target of an invocation." , exception After IStream_Read() function.
Judging by this you have not done the try-catch block correctly as you have not specified the error code and information.
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply