• 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
[SOLVED]: Content incomplete when calling dataWithPDFInsideRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED]: Content incomplete when calling dataWithPDFInsideRect


  • Subject: [SOLVED]: Content incomplete when calling dataWithPDFInsideRect
  • From: Tito Ciuro <email@hidden>
  • Date: Sat, 3 Jun 2006 15:38:43 -0700

Hello Lon,

I don't know if this is the right way to do it, but it works: I get the PDF image rep and then invoke PDFRepresentation:

- (IBAction)savePDFData:(id)sender
{
    NSImage *theImage = [_mapImageView image];
    NSArray *representations = [theImage representations];
    NSEnumerator *enumerator = [representations objectEnumerator];
    id anObject;
    NSPDFImageRep *thePDFRep = nil;

    while (anObject = [enumerator nextObject]) {
        if ([anObject isKindOfClass:[NSPDFImageRep class]]) {
            thePDFRep = anObject;
        }
    }
    if (thePDFRep) {
        NSData *imageData = [thePDFRep PDFRepresentation];

// Save to Desktop...
NSString *filePath = [[NSString alloc]initWithFormat:@"%@/ Desktop/__WPTempUserImageIn.pdf", NSHomeDirectory()];
[imageData writeToFile:filePath atomically:YES];
[filePath release];
}
}


Thanks for the help!

-- Tito

On Jun 3, 2006, at 2:48 PM, Lon Giese wrote:


Have you tried to:
get the image from the image view, then get the PDF represenatation from the image, then get the data from the representation?


- (NSData *)PDFRepresentation
Returns the PDF representation of the receiver. The returned PDF data is a copy of the data used to create the receiver.




WooHoo the ultimate Mac App for 'The Sims 2' power users.
http://www.modthesims2.com/showthread.php?p=1239629
On Jun 3, 2006, at 1:52 PM, Tito Ciuro wrote:

Hello,

My app has an NSImageView where I drop PDF files. I would like to retrieve the PDF representation of the imageview content, so I've tried:

NSData *imageData = [_mapImageView dataWithPDFInsideRect: [_mapImageView frame]];

The problem is that I get the snapshot of the imageview itself + the visible portion of the content. In other words, as if I had made a screen capture of the imageview.

Ideally, I'd like to output the content of the imageview to a new file and see the exact contents and format (PDF) as the original one. Something like this:

- (IBAction)savePDFData:(id)sender
{
NSData *imageData = [_mapImageView dataWithPDFInsideRect: [_mapImageView frame]];


// Save to Desktop...
NSString *filePath = [[NSString alloc]initWithFormat:@"%@/ Desktop/TempImageOut.pdf", NSHomeDirectory()];
[imageData writeToFile:filePath atomically:YES];
[filePath release];
}


Thanks for the help,

-- Tito
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40frontiernet.net


This email sent to email@hidden

_______________________________________________
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

_______________________________________________ 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: 
 >Fwd: Content incomplete when calling dataWithPDFInsideRect (From: Lon Giese <email@hidden>)

  • Prev by Date: how do I kill and quit processes/daemons?
  • Next by Date: Re: NSView+NSDrawer+nextKeyView
  • Previous by thread: Fwd: Content incomplete when calling dataWithPDFInsideRect
  • Next by thread: how do I kill and quit processes/daemons?
  • Index(es):
    • Date
    • Thread