Menu

#3 PdfDocument save without setting stream's position

open
None
5
2016-06-16
2016-06-13
No

Hi, could you please create overload or other method Save for PdfDocument class, which won't set stream's Position explicitly. It would be great to reduce memory overhead and sent generated PDF directly to WebApi's PushStreamContent, NetworkStreams and other stuff.
Thanks

Discussion

  • PDFsharp Team

    PDFsharp Team - 2016-06-13

    For clarity: Do you want PDFsharp to work with streams that do not support setting the position?
    Do you want PDFsharp to work with streams that already have contents?
    The former can be achieved with a trivial change, the latter would require a bit more effort.

     
  • Volodymyr Melnychuk

    Thank you for quick response. The first one, without setting position.

     
  • PDFsharp Team

    PDFsharp Team - 2016-06-16

    The current implementation sets the Position to 0 before returning from Save(), but it queries Position several times during the creation of the PDF. Do you get an exception from the final "setter"? Or do you get exceptions from the "getter" at an earlier stage? The former can easily be avoided, the latter requires bigger changes (too big for 1.50 final).
    The .NET documentation isn't very clear and implementation may vary between different Stream classes. Which Stream class did you use when you encountered the problem? Would you share sample code?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.