• 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: Help with PDFPage to NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with PDFPage to NSImage


  • Subject: Re: Help with PDFPage to NSImage
  • From: Florian Soenens <email@hidden>
  • Date: Wed, 27 Feb 2008 13:45:09 +0100

Hi Antonio,

my pdf document gets created.
The index is also valid.

The source pdf does display correctly in Preview and i'm using Leopard.
Here's my output:

2008-02-27 13:42:14.710 ThumbNailFixedWidthLine[26446:10b] _NXCreateWindow: error setting window property (1002)
2008-02-27 13:42:14.910 ThumbNailFixedWidthLine[26446:10b] _NXTermWindow: error releasing window (1002)
2008-02-27 13:42:14.973 ThumbNailFixedWidthLine[26446:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
2008-02-27 13:42:14.974 ThumbNailFixedWidthLine[26446:10b] Stack: (
2489950827,
2494017691,
2489950283,
2489950346,
2524632528,
2524631756,
2524630962,
2524630360,
2524627265,
2524626936,
2524626545,
11120,
8922,
8705
)
Trace/BPT trap


Can you help me out?
Txs,
Florian.

On 27 Feb 2008, at 11:33, Antonio Nunes wrote:

On Feb 27, 2008, at 10:32 AM, Florian Soenens wrote:

i don't understand why this simple code is not working:

PDFDocument *pdfDocument = [[PDFDocument alloc] initWithURL:inputurl];
PDFPage *currentPage = [pdfDocument pageAtIndex:i];
NSImage *image = [[NSImage alloc] initWithData:[currentPage dataRepresentation]];
NSData *tiffRep = [image TIFFRepresentation];
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithData:tiffRep];
NSData *bitmapData = [rep representationUsingType:NSJPEGFileType properties:NULL];
[bitmapData writeToURL:outurl atomically:YES];

You do not explain which part is not working. The code that should produce the bitmapData looks allright, so my guess is that either the document is not loaded in the first line because of a problem with the input URL, or i is an invalid index in line 2, or the output URL in the last line is invalid.


Failing all that there are some other more esoteric reasons why e.g your output may simply be empty. That can happen when PDFKit has trouble with the source document. Are you running this on Tiger or on Leopard? Does the source PDF display correctly in Preview?

-António

----------------------------------------------------
Energy is like a muscle,
it grows stronger through being used.
----------------------------------------------------





Looking for Web-to-Print Solutions? Visit our website : http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information and/or information protected by intellectual property rights. If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail and/or any file transmitted with it, is strictly prohibited and may be unlawful. If you have received this e-mail by mistake, please immediately notify the sender and permanently delete the original as well as any copy of any e-mail and any printout thereof. We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Help with PDFPage to NSImage
      • From: Antonio Nunes <email@hidden>
References: 
 >Help with PDFPage to NSImage (From: Florian Soenens <email@hidden>)
 >Re: Help with PDFPage to NSImage (From: Antonio Nunes <email@hidden>)

  • Prev by Date: Re: NSStringFromClass versus className ?
  • Next by Date: Re: NSComboBoxCell will not select
  • Previous by thread: Re: Help with PDFPage to NSImage
  • Next by thread: Re: Help with PDFPage to NSImage
  • Index(es):
    • Date
    • Thread