PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Mar 29, 2024 3:49 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Check file size
PostPosted: Wed Nov 13, 2013 9:01 pm 
Offline

Joined: Wed Nov 13, 2013 8:39 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Check file size
PostPosted: Thu Nov 14, 2013 9:56 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Check file size
PostPosted: Fri Nov 15, 2013 7:16 pm 
Offline

Joined: Wed Nov 13, 2013 8:39 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Check file size
PostPosted: Sat Nov 16, 2013 5:57 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 339
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).

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 178 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group