Re: Printing questions
Re: Printing questions
- Subject: Re: Printing questions
- From: Jonathan Mitchell <email@hidden>
- Date: Mon, 13 Mar 2017 13:33:03 +0000
> On 12 Mar 2017, at 21:23, Daryle Walker <email@hidden> wrote:
>
>
>
> Sent from my iPhone
>
>> On Mar 12, 2017, at 5:18 AM, Daryle Walker <email@hidden> wrote:
>>
>> I hope it’s a nice first try, but I have some concerns.
>>
>> 1. I also added an “Export as PDF…” menu item, which uses the save-as-PDF default action. I guess it calls my code, but the docs for “NSDocument.pdfPrintOperation” say I should use a separate print-information objects for PDF mode. Does the default code take care of that already? Or do I have to figure out somehow if I’m in print-to-PDF mode or regular print mode and change the initialization of “info” above to be “self.pdfPrintOperation” as needed?
>
> And this is why you shouldn't post half-tired. It's "pdfPrintOperation," not "pdfPrintInfo," so my override wouldn't be called by definition. I guess I would override "pdfPrintOperation" to attach a custom print-info, but what should be in it? Is there some Apple sample code on this property? I didn't find it at all on GitHub.
For NSDocument pdfPrintOperation The docs say :
Important
This property does not copy the document’s printInfo to the PDF printing operation object. Your app should maintain a separate NSPrintInfo instance specifically for creating PDFs and assign it to the printInfo property of the operation object.
So just just set the printInfo on the operation.
As to how you configure the printInfo it depends on what output you require - in general its just a bunch of print settings for page size, margins etc.
However there are a few save related settings.
// flag as a PDF save job
[printInfo setJobDisposition:NSPrintSaveJob];
// Set the target destination for the file
[printInfoDictionary setObject:pdfInfo.URL forKey:NSPrintJobSavingURL];
Jonathan
_______________________________________________
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