Allow pdf export to .Net memorystream

Please allow the export of PDF files into a .NET memorystream. MemoryStream Class (System.IO) | Microsoft Learn



Today we loose a lot of performance as we first have to export the PDF file on disk, read it into memory afterwards to extend the PDF file metadata and write it back again to disk. If we could get a memorystream of the exported PDF file, we can manipulate the PDF file directly and write it only one time to disk. In todays world with virus scanners which upload samples to the internet in the background to check for infection, this would really help.



Also a lot of Windows Explorer Addins try to anaylze files written to disk, like DropBox.

Sounds good. Could be an Option for all File operations. (Declaring Pictures via File). If your going to code this prepare an second Api call that Supports the IStream Interface instead. (Microsoft IStream Interface IStream (objidl.h) - Win32 apps | Microsoft Learn)

Also missing:

  • Initialize PreviewControl from MemoryStream
  • Initialize PreviewFile from MemoryStream
  • Convert PreviewFile to PDF using MemoryStream

Loading, manipulation, exporting and printing a ProjectFile works just fine.

According to the help file there is an overload of the ExportConfiguration-class which should take an export-stream parameter as the second one … so in theory this should already work …

But I have tried to get this working (and also opened a support case without any reacting) I would give hundreds of votes if possible :wink: because this would be my number one feature, too.

I must correct my comment: it is already working … the following code shows how it works for me:

----- schnipp ------
System.IO.MemoryStream stream = new System.IO.MemoryStream();
ExportConfiguration exportConfig = new ExportConfiguration(LlExportTarget.Pdf, stream, LL.AutoProjectFile);
LL.Export(exportConfig);
----- schnapp -----

And now the same with a preview:

I have a preview as memory stream.

I want to convert it to a pdf as memory stream