memoryStream, dll version, viewing PDF's
Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2023
Printed Date: 04 Apr 26 at 8:24PM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: memoryStream, dll version, viewing PDF's
Posted By: greenley
Subject: memoryStream, dll version, viewing PDF's
Date Posted: 01 Nov 11 at 8:44PM
Using dll evaluation version 8.12 with C++ Builder 6, want to save pdf stream to use WPViewPDF component to open from stream to avoid creating a temp file. dll version does not support SaveToStream, WPViewPDF only opens from Stream or File. Suggestions? Is it possible to SaveToString, convert that to Stream and then open from Stream? If so, how? Is there a better answer for viewing the pdf's, I want to avoid temp files, not require adobe, and give option to save or print pdf from the viewer. Thanks Bill Greenley
|
Replies:
Posted By: Ingo
Date Posted: 01 Nov 11 at 9:35PM
Hi Bill!
If you want these things why not search for them? Try this with Google ... Delphi String to Stream ... and you'll get enough inspirations ;-)
Cheers and welcome here, Ingo
|
Posted By: greenley
Date Posted: 01 Nov 11 at 10:40PM
Fixed: The following code works, maybe it can help someone else.
I always search first. I have searched and tried a number of methods before I posted, using dll version with C++ Builder 6.
My latest attempt is: // above is code that creates a pdf TMemoryStream *pMS = new TMemoryStream; string memStr = QP.SaveToString(); int i = memStr.length(); pMS->Write(memStr.c_str(),memStr.length()); // saving stream to file to test before trying opening stream in WPViewPDF pMS->SaveToFile(L"junk.pdf"); // files does not open, acrobat says is corrupt, // both have same size (6072 bytes) QP.SaveToFile(L"junk1.pdf"); // file is valid and opens in acrobat
I am sure it is a foolish error, but I just can't seem to find it. junk1.pdf opens fine, but junk.pdf does not, something is getting scrambled in the SaveToString -> Write to Stream -> Stream SaveToFile, i does show the correct length of 6072.
Bill Greenley
|
|