PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Check file size
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2647
Page 1 of 1

Author:  con1 [ Wed Nov 13, 2013 9:01 pm ]
Post subject:  Check file size

I have issue where I need to check file size of a new PDF document before I save it. How can i do that. If I save, I can get filesize but its too slow to save after adding each page.

Is there a way to check PDF size without saving???

Thanks

Author:  Thomas Hoevel [ Thu Nov 14, 2013 9:56 am ]
Post subject:  Re: Check file size

con1 wrote:
Is there a way to check PDF size without saving???
No way I know of.
Only when you save PDFsharp will compile the data that is needed, will compress and save it.

Author:  con1 [ Fri Nov 15, 2013 7:16 pm ]
Post subject:  Re: Check file size

What about saving in MemoryStream and get size of the pdf? Will that give proper size if so is it in bytes, kb etc.

thnaks

Author:  () => true [ Sat Nov 16, 2013 5:57 pm ]
Post subject:  Re: Check file size

A MemoryStream will give you the correct size in bytes.
And if the size if fine, then just write the MemoryStream to a file (no need to generate the same PDF again).

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/