Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 13, 2019 11:21 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: MBS - Core Graphics and PDFs, adding images
PostPosted: Wed Jun 30, 2010 8:06 am 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
I have a PDF file I need to add an image to. I had been creating a new PDF and then drawing my old PDF to it as a picture and then drawing the image to it. This obviously reduces the quality to 72DPI, it also converts vector images to bitmap images and increasing the size.

So starting with a CGPDFDocumentMBS, what is the easiest way to add an image to it whilst retaining its current format, and ending up with another CGPDFDocumentMBS that is identical to the first with the addition of an image.
Imagine I'm simply adding a logo to an existing PDF.

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS - Core Graphics and PDFs, adding images
PostPosted: Wed Jun 30, 2010 8:45 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
To add an image with higher resolution you take your picture which has a high resolution and add it to the PDF with a smaller rectangle.

So if the Image has 3000 x 2000 pixels in size and your rectangle on the PDF is 3000/300*72 = 720 pixel by 2000/300*72 = 480 pixel, you have it in the PDF with 300 dpi.

Drawing an existing PDF Page in CoreGraphics should retain the original resolution. Not sure what you are doing.
If you render a PDF Page to a picture with low resolution and add it to a new PDF, you get poor quality. And in general you should not do this, but add the page directly.

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 - Core Graphics and PDFs, adding images
PostPosted: Wed Jun 30, 2010 10:03 am 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
I'll clarify my question.

How do I draw an existing PDF to a new PDF? I had been converting it to a picture.

Dim PDF1,PDF2 as CGPDFDocumentMBS


How do I draw PDF1 to PDF2?

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS - Core Graphics and PDFs, adding images
PostPosted: Wed Jun 30, 2010 10:08 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
The CGContextMBS class has a method for this:

DrawCGPDFDocument(pdf as CGPDFDocumentMBS, rect as CGRectMBS, page as integer)

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 - Core Graphics and PDFs, adding images
PostPosted: Wed Jun 30, 2010 10:26 am 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
:oops:

thanks

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group