Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Jan 29, 2020 8:43 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: MBS PDFKit Render and Landscape Page question
PostPosted: Sat Mar 12, 2011 11:30 am 
Offline

Joined: Sun Jan 23, 2011 11:59 am
Posts: 465
I use pretty much this code from the help file

dim f as FolderItem = GetFolderItem(”Castles.pdf”)
dim doc as new PDFDocumentMBS(f)
dim page as PDFPageMBS = doc.pageAtIndex(0)
dim image as NSImageMBS = page.Render
Backdrop = image.CopyPicture


It works great if the page is in Portrait Mode but if the page is landscape, the picture rendered would be cropped and only showing the left side.

Manually, I issued
image.rotate = 180

which causes the page to be rotated but at least the whole page renders 90º counter-clockwise. Then I rotate it back in the background which works.

However, the pdf document I work with contains both portrait and landscape pages so I cannot assume they are in one orientation.

I tried to get the width and height through the page.render.width and page.render.height but they do not tell me the landscape dimension (ie width > height) but rather it just tells me the portrait dimension.

How do I go about finding out if the pdf page is landscape or portrait ?

Thanks.

_________________
RealStudio 2012R1 ♡ Macbook Pro Mac OS X 10.8.1 Moutain Lion
http://www.batchimage.com


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS PDFKit Render and Landscape Page question
PostPosted: Sat Mar 12, 2011 3:46 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
I have to check that. Maybe my render code does not handle landscape properly.

Can you send me a little example and the PDF file. Would save me some time.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS PDFKit Render and Landscape Page question
PostPosted: Sat Mar 12, 2011 6:14 pm 
Offline

Joined: Sun Jan 23, 2011 11:59 am
Posts: 465
Actual I played with the codes a little more, it appears it is more the issue of the PDF files rather than your renderer. It appears that the page has a different Rotation value than 0 and thus the issue.

Just a simple code, I set all rotation which is 90 to 0 and all 270 to 180 and then use the NSImageMBS to do the rotation after that.

There are some landscape PDF which I created myself with rotation 0 works well.

Sorry about that. At least I learn something new :)

_________________
RealStudio 2012R1 ♡ Macbook Pro Mac OS X 10.8.1 Moutain Lion
http://www.batchimage.com


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS PDFKit Render and Landscape Page question
PostPosted: Sun Mar 13, 2011 11:44 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
That's a good idea. I tried now for an hour to fix it in PDFPageMBS class, but this does not work. PDFKit seems to ignore my rotation of the graphics context. So your idea is the way to go.

PS: We had the same problems today with DynaPDF render function, but there it's fixed now.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS PDFKit Render and Landscape Page question
PostPosted: Sun Mar 13, 2011 12:16 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
I fixed the Render function, so new plugins will give you the correct picture :-)

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS PDFKit Render and Landscape Page question
PostPosted: Sun Mar 13, 2011 4:11 pm 
Offline

Joined: Sun Jan 23, 2011 11:59 am
Posts: 465
Thank you very much.

_________________
RealStudio 2012R1 ♡ Macbook Pro Mac OS X 10.8.1 Moutain Lion
http://www.batchimage.com


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

All times are UTC - 5 hours


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group