I've had some problem setting the size of the output image in the code below (which I found as an answer to another StackOverflow question).
I need to output the images as small previews and High Res images. But no matter what, it only outputs in 596 x 842.
I tried changing the size with the setSize method, but it only changes the size of the image, leaving a tiny image in a big blank space. I can't get it to scale properly.
Anyone has an idea?
NSPDFImageRep *img = [NSPDFImageRep imageRepWithContentsOfFile:pdfPath];
NSImage *temp = [[NSImage alloc] init];
NSBitmapImageRep *rep;
int count = [img pageCount];
for(int i = 0 ; i < count ; i++)
{
[img setCurrentPage:i];
[temp addRepresentation:img];
rep = [NSBitmapImageRep imageRepWithData:[temp TIFFRepresentation]];
NSData *finalData = [rep representationUsingType:NSJPEGFileType properties:nil];
NSString *pageName = [NSString stringWithFormat:@"%d.jpg", [img currentPage]];
[fileManager createFileAtPath:[NSString stringWithFormat:@"%@/%@", localPath, pageName] contents:finalData attributes:nil];
}
Thanks in advance.
NOTE : This is a Mac OSX application.