Re: Using CALayer to display a PDF ?
Re: Using CALayer to display a PDF ?
- Subject: Re: Using CALayer to display a PDF ?
- From: Gabriel Zachmann via Cocoa-dev <email@hidden>
- Date: Sun, 5 Jan 2025 18:47:59 +0100
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?
Best, G.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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