PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 11:10 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: MediaBox Way Off!
PostPosted: Mon Mar 22, 2010 5:17 pm 
Offline

Joined: Wed Oct 29, 2008 7:55 pm
Posts: 7
I've got a pdf (Not created by PDFsharp), whose page size is 8.5 by 11 (612 by 792) but the actual size of the page with hidden content is 612 by 11796. The MediaBox and CropBox is located at 11004, therefore the content between 11004 and 11796 is the actual viewable portion of my pdf page. My problem is when I try gfx.DrawString at (gfx.PageSize.Height - 250) it puts it in the unviewable portion, of course, since 792 - 250 = 542.
I know I could just determine the position of the MediaBox and offset the place where I DrawString but my problem lies deeper than just this.

A quick fix to my problem if it's possible is to move the content of the MediaBox to the top of the page so that everything starts at (0,0). Is this possible?

For those more interested in my deeper problem for curiousity:
In different code in my program, I use the Adobe Interop to get the JSObject to determine the mouse position on the page. At that location is where I do a DrawString. The mouse.y coordinate reports the 11004-11796 location but every pageBox in the JSObject reports the size as 612 by 792, even the MediaBox and CropBox.

_________________
If hope could grow from dirt like me, it can be done.


Top
 Profile  
Reply with quote  
 Post subject: Re: MediaBox Way Off!
PostPosted: Fri Mar 26, 2010 12:14 pm 
Offline

Joined: Wed Oct 29, 2008 7:55 pm
Posts: 7
Nevermind.

I found that instead of adding the Location.Y of the MediaBox I subtract Location.Y of the MediaBox. This draws the string at -10462. This doesn't make much sense to me, but it works.

For the deeper problem:
I find out the offset of the MediaBox for each page prior to calling the JSObject. I then add the offset to the mouse.y value to determine if the mouse location is within the page.

_________________
If hope could grow from dirt like me, it can be done.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 386 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