EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Load ElPDFDocument from TMemoryStream

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#16068
Posted: 03/16/2011 06:47:10
by Dust Michael (Standard support level)
Joined: 08/24/2010
Posts: 4

Hi,
I just started to intigrade the SecureBlackbox Components into my application to sign pdf-documents. Everything works fine as long I work with files (I load them with a TFileStrem). But now I want to use the TMemoryStream because it is more flexible with alternative datasources.

I always get access violations when I open the document. Any ideas?

Code
function GetDocument(outDocument: TElPDFDocument;
  inMSFile : TMemoryStream): Boolean;
begin
  Result := false;
  try
      inMSFile.SaveToFile('c:\test.pdf'); //works fine (for testing)
      outDocument.Open(inMSFile); //access violation
      Result := true;
  except on e:exception do
  begin
    Showmessage(e.Message);
  end;
end;
#16069
Posted: 03/16/2011 06:51:00
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Are u sure that u're not missing a inMSFile.Seek(0,soFromBeginning); just before the savetofile? ;)
#16070
Posted: 03/16/2011 06:52:50
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

*after SaveToFile* instead of before of course...
#16071
Posted: 03/16/2011 07:06:46
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Santiago is right. Please try to add the line of code that he suggested.
#16072
Posted: 03/16/2011 07:42:16
by Dust Michael (Standard support level)
Joined: 08/24/2010
Posts: 4

Thanks for the help. I found out that the outDocument wasn't created right. Sorry for wasting your time ^^

Quote
if not assigned(Document) then
Document := TElPDFDocument.Create(nil); //never called
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 1027 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!