Re: PDF Problem
Re: PDF Problem
- Subject: Re: PDF Problem
- From: Jens Bauer <email@hidden>
- Date: Fri, 9 Jan 2009 13:38:56 +0100
Hi Devon,
Perhaps you're looking in the wrong direction.
Try checking if the image type on Leopard is the same as the image
type on Tiger.
If the image type on Tiger is 8 bit (or monochrome), and the image
type on Leopard is 24-bit color, it might be the image itself, which
forces your output to look like it's not antialiased.
-To me, it looks like Tiger is trying to antialias the PDF, but it
doesn't succeed, due to the number of colors are limited in the image.
Try opening the two saved pictures in Preview, and then click Tools :
Inspector to see details about the images.
Love,
Jens
On Jan 9, 2009, at 13:04, Devon Govett wrote:
Hello everyone,
Sorry about the double post, but the link to the images did not make
it.
I have developed an application that converts a PDF to a bitmap
image. The program creates an image in which all of the pages in the
PDF are stacked - one on top of the other. But I have a problem.
When the program is run on a PowerPC running Tiger, the quality is
much worse than when I do the same thing from an Intel based machine
running leopard. I think that maybe the Tiger api is not
antialiasing, but I tried explicitly telling it to do so with no
effect. The code is below:
NSRect viewBounds = [[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxMediaBox];
int height = (int)(viewBounds.size.height * 1.25) * [pdfDoc
pageCount];
int pageHeight = (int)(viewBounds.size.height * 1.25);
NSRect rect = { 0,height-pageHeight, 990, pageHeight };
NSSize size = NSMakeSize(990, height);
NSImage * compositeImage;
compositeImage = [[NSImage alloc] initWithSize:size];
[compositeImage lockFocus];
[[NSGraphicsContext currentContext]
setImageInterpolation: NSImageInterpolationHigh];
[[NSGraphicsContext currentContext] setShouldAntialias:YES];
NSData* theData = [pdfDoc dataRepresentation];
NSPDFImageRep* pdfRep = [NSPDFImageRep imageRepWithData:theData];
NSImage* pdfImage;
int i;
for(i=0;i<[pdfDoc pageCount];i++){
[pdfRep setCurrentPage:i];
NSRect pageW = [[pdfDoc pageAtIndex:i]
boundsForBox:kPDFDisplayBoxMediaBox];
pdfImage = [[NSImage alloc] initWithSize: pageW.size];
NSSize fullSize = NSMakeSize(pageW.size.width*1.25, pageHeight);
[pdfImage setScalesWhenResized:YES];
[pdfImage setSize:fullSize];
[pdfImage addRepresentation:pdfRep];
NSRect r = { 0, rect.origin.y, pageW.size.width*1.25, pageHeight };
[pdfImage drawInRect: r
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0];
[pdfImage release]; pdfImage = nil;
rect.origin.y -= pageHeight;
}
[compositeImage unlockFocus];
NSData *imageData = [compositeImage TIFFRepresentation];
NSBitmapImageRep *imageRep = [NSBitmapImageRep
imageRepWithData:imageData];
NSDictionary *imageProps = [NSDictionary dictionaryWithObject:
[NSNumber numberWithFloat:0.9] forKey:NSImageInterlaced];
imageData = [imageRep representationUsingType:NSJPEGFileType
properties:imageProps];
[imageData writeToFile:@"/Users/devon/Desktop/out.jpg"
atomically:YES];
You can view images of the results at http://our-voice.info/results.html
Any help would be fantastic!
Devon
_______________________________________________
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
_______________________________________________
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
References: | |
| >PDF Problem (From: Devon Govett <email@hidden>) |