PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Page sizes (bytes, not inches)?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
Chris Duncan



Joined: 12 Nov 2007
Posts: 4

PostPosted: Mon Nov 12, 2007 3:51 am    Post subject: Page sizes (bytes, not inches)? Reply with quote

Could someone please point me to sample code or sketch the key properties I'd need to access to determine (or even just get a reasonable estimate) of the size (in bytes) of one or more pages in a PDF?

I need to break existing PDFs into several smaller PDFs where each part should not exceed a specified size. These PDFs typically are just scanned documents, so the contents are image files, so maybe it's good enough if I can just find out (in code) the size of each page's image file, but it would be better to have a general solution that knows how big the entire page is.

Is it simply the size (in bytes) of the stream object that I want?

Once I know how to calculate/estimate page sizes, the code is simple: accumulate pages until the current page exceeds the threshold; save all the previous pages to a new file, and continue starting from the current page...

Thanks in advance for any help.

Chris
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Nov 12, 2007 10:48 am    Post subject: Re: Page sizes (bytes, not inches)? Reply with quote

Chris Duncan wrote:
Is it simply the size (in bytes) of the stream object that I want?

A page can reference multiple objects (fonts, image, ...).
And objects can be referenced by multiple pages (fonts, logos, ...).

There is no simple solution (in general).

If you have a 1:1 relation between pages and images then you can go the easy way ...
... and take the sizes of the images.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Chris Duncan



Joined: 12 Nov 2007
Posts: 4

PostPosted: Mon Nov 12, 2007 4:10 pm    Post subject: Reply with quote

Ok, so a general solution is not possible...

But yes, for the current project there is indeed a 1:1 correspondence between pages and images - these particular PDFs are just scanned documents, one image per page.

So, if you could give me an example of the object reference I need to get the size of an image on a page, that would be a big help (that is, it would save me a lot of time figuring out something that is hopefully already at your fingertips... I hope I'm not asking too much!).

Thanks,

Chris
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Nov 12, 2007 4:23 pm    Post subject: Reply with quote

Well, it seems all you need to know (to solve this task) is in the ExportImages sample in the samples folder:
PDFsharp\Samples C#\ExportImages
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com