• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem converting pdfs to jpegs with Cocoa & Quartz...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem converting pdfs to jpegs with Cocoa & Quartz...


  • Subject: Re: Problem converting pdfs to jpegs with Cocoa & Quartz...
  • From: Michael Heinz <email@hidden>
  • Date: Mon, 09 May 2005 11:55:21 -0400

Thanks, Sven.

I'll give that a try.

On Monday, May 09, 2005, at 08:54AM, Sven Hoffmann <email@hidden> wrote:

>Hallo Maichael,
>
>I suggest you create a NSImage from the pdf file and use NSImages
>drawInRect:fromRect:operation:fraction: method to draw it into into the
>current context.
>
>Here's the documentation of the method:
>
>"- (void)drawInRect:(NSRect)dstRect fromRect:(NSRect)srcRect
>operation:(NSCompositingOperation)op fraction:(float)delta
>
>Partially composites the srcRect portion of the image inside the
>dstRect portion of the current coordinate system, using the specified
>operation, op. delta is a fraction from 0.0 to 1.0 that specifies how
>much of the resulting composite will come from the NSImage. The
>composite is positioned and oriented according to the current
>coordinate system. The image is rotated and scaled as needed."
>
>The last sentence, _The image is rotated and scaled as needed_ , should
>take care of your problem.
>
>So you could go like this:
>
>    0) create an image A from the pdf file.
>    1) create an image B of the desired size.
>    2) add bmpImageRep to B.
>    2) lock focus on B.
>    4) call [ A drawInRect...] s.above
>    ...
>
>
>
>On May 9, 2005, at 1:40 PM, Michael Heinz wrote:
>
>> Hello, all.
>>
>> I'm working on a little program to convert PDF pages to jpegs for
>> display on a handheld device; I figured out how to do everything, the
>> rotations and so forth, but I'm stuck on one odd issue: I can resize
>> the resulting image to make it smaller than the original PDF and that
>> works fine, but if I try to resize it to larger than the original PDF
>> it doesn't work - I get the PDF rendered in the middle of a larger
>> box.
>>
>> This is a bit of a problem, since a PDF's "size" is measured in terms
>> of 72 dpi, so a document 8 inches wide is only 576 pixels, which means
>> small details are hopelessly blurry in the final image.
>>
>> Can anyone give me a suggestion on how to handle this correctly?
>>
>> The approach I'm taking is:
>>
>> 1) create an image of the desired size.
>> 2) lock focus.
>> 3) get context.
>> 4) save state.
>> 5) create drawing transform and attach.
>> 6) render page.
>> 7) restore state.
>> 8) get bitmap representation.
>> 9) unlock focus.
>> 10) convert bitmap to jpeg.
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> email@hidden
>>
>> This email sent to email@hidden
>>
>------------------------------------------------------------------------
>------------
>Sven Hoffmann
>R&D Macintosh Software Develover
>
>Email: email@hidden  Tel. 03-6362331
>Aladdin Knowledge Systems Ltd.
>http://www.aladdin.com
>**********************************************************************************************
>**************************************************************************************************The contents of this email
>and any attachments are confidential.They are intended for the named recipient(s) only.If you have received
>this email in error please notify the system manager or  the sender immediately and do not disclose the
>contents to anyone or make copies.** eSafe scanned this email for viruses, vandals and malicious content.
>****************************************************************************************************
>**********************************************************************************************
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem converting pdfs to jpegs with Cocoa & Quartz... (From: Michael Heinz <email@hidden>)
 >Re: Problem converting pdfs to jpegs with Cocoa & Quartz... (From: Sven Hoffmann <email@hidden>)

  • Prev by Date: Re: NSDocument for a multi-window application
  • Next by Date: Re: plain text and Spotlight
  • Previous by thread: Re: Problem converting pdfs to jpegs with Cocoa & Quartz...
  • Next by thread: Re: Problem converting pdfs to jpegs with Cocoa & Quartz...
  • Index(es):
    • Date
    • Thread