site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1736099523; bh=frYZhvv4ymhVVSMJhuBsjRDBAxy87YrC9Ppt8InKAB4=; h=Content-Type:Mime-Version:Subject:From:Date:Message-Id:To: x-icloud-hme; b=RuIiT6T9pMFUOAzCq2DP61eVuc1EIsoxKDVICEKQMvlvwVoXlSSIuxVAVR9RrKpwZ akKVcSsz/PxAb6rGbnF5BU/UNY3XApi/57dJJoLZJDDmhY90rN9LWxT6FNAvnxigbl joFfMTXBl1bZteXf12xLM4b1Zc3Ki5FFyF++JNruTzukM9jI8AmXMQGcRKWSS8kfpv SFIclco2b8u/nnmAGo0/TTj0LfxnPCR73p/WvLFPvrusyE6L/JmadUr8dybocqqh9T Zq6WCfJdSnW0R6mtfNFQ1bD9dWIH69JXAzF13V6QxzR/9RozuSxnmMuj2s9aNXCeKe UwOZey/2X8gHw== Try it out!
On Jan 5, 2025, at 11:47 AM, Gabriel Zachmann via Cocoa-dev <cocoa-dev@lists.apple.com> 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?
Best, G.
_______________________________________________
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/zav%40mac.com
This email sent to zav@mac.com
_______________________________________________ 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/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com