On 1/5/25 9:47 AM, Gabriel Zachmann via Cocoa-dev wrote:
Thanks a lot to both of you!
I'm sure there's more than one way to do it, but one way is to create an
NSPDFImageRep. You can then get a CGImageRef from that, or on macOS,
create an NSImage and set that as the layer contents.
I forget to mention that I am developing an app for macOS. Sorry!
So, being totally new to handling PDFs in my code, I would use something like
PDFDocument *pdfDoc = [[PDFDocument alloc] initWithURL:url];
then something like
imagePDFrep = [NSPDFImageRep imageRepWithData: pdfDoc];
then something like
imageOfFirstPage = [ [NSImage init] addRepresentation: imagePDFrep];
?
Is that the general gist of it?
No, imageRepWithData: takes an NSData* parameter. It's just the
contents of a PDF file.
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com