Questions tagged [nsprintoperation]
57 questions
1
vote
2 answers
Using NSPrintOperation from WKWebView
How to print the content of a WKWebView using printOperation(with:)?
First try
let info = NSPrintInfo.shared
let operation = printOperation(with: info)
operation.run()
But I get a crash with the message:
[Printing] ERROR: The NSPrintOperation…

vicegax
- 4,709
- 28
- 37
1
vote
1 answer
MacOS / appkit NSPrint logic for printing long, complex reports
We have an app that has many reports, and some of those reports have complex print loops.
Back in the day (IE PowerPlant , Carbon, Core Printing) we used to create print loops that had some sort of BeginPage() / EndPage() pair. Frequently, those…

SMGreenfield
- 1,680
- 19
- 35
1
vote
0 answers
Swift Cannot print from NSView "CGContextGetCTM: invalid context 0x0"
I'm making a macOS app at the moment, and I'm trying to support printing. I've added NSBox to represent the pages I want to print inside an NSScrollView, so the hierarchy looks like this
NSScrollView
|- NSDocumentView
|- NSBox
|- NSBox
In…

Joseph Williamson
- 771
- 1
- 6
- 18
1
vote
0 answers
When to resize my NSView for printing?
I have an NSView subclass specifically for printing. I want it to fit the width to the page and the height to the number of records.
But I haven't really found a good spot to size the view. I'm currently sizing the view in -beginDocument (because I…

uliwitness
- 8,532
- 36
- 58
1
vote
2 answers
Stopping NSPrintOperation From Crashing Application
I have the following lines of code to print the webView content.
let directoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let printOpts: NSDictionary = [NSPrintJobDisposition: NSPrintSaveJob, NSPrintSaveJob:…

El Tomato
- 6,479
- 6
- 46
- 75
1
vote
1 answer
NSTableView data disappears when print panel settings are changed
I am trying to print data populated in an NSTableView through a custom NSView. When the print command is issued by the user, the custom NSView containing the NSTableView is shown in the Print Panel as expected
The problem I am encountering is as…

Curious Yogurt
- 25
- 4
1
vote
0 answers
How to do printing from COCOA APPLICATION in OSX?
I am creating a file manager where i attach files and folder of any type , i keep the URLs of the file in my application . I have a Print button and depending upon the type of file i want to print that file .
How can I achieve this…

Hassan Malik
- 559
- 6
- 20
1
vote
2 answers
How do I set the printInfo to print in landscape in OS X?
I have set the following code:
let printInfo = NSPrintInfo.sharedPrintInfo
let textPrint = NSPrintOperation(view: theTextView,printInfo: printInfo())
Now I would like to set the orientation to Landscape, but I can't find any Swift functions that do…

TMan
- 11
- 2
1
vote
2 answers
Need to Print a Custom Header using obj-c
I am creating an NSView and it prints fine with this piece of code :
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
[printInfo setHorizontalPagination:NSFitPagination];
[printInfo setHorizontallyCentered:YES];
[printInfo…

Yogu
- 23
- 3
1
vote
1 answer
How to know if print operation was cancelled?
I am using (NSPrintOperation *)printOperationWithView:(NSView *)aView printInfo:(NSPrintInfo *)aPrintInfo method to print a view in my OS X app. All works as expected. Is there a way to catch the event when the user has cancelled the print operation…

DORI
- 54
- 1
- 8
1
vote
1 answer
Issues with printing a custom view to printer
Working on printing a custom view and I am having difficulties - hope someone can point me in the right direction. I have read just above every Apple document but it's just not working.
I created a simple program to test the printing, I subclassed…

littleDrummerBoy
- 157
- 11
1
vote
1 answer
NSPrintOperation to PDF doesn't present header and footer in the view
I have a NSTextView contain table of data, and i override the drawPageBorderWithSize: method to draw page footer (page number) and page header contain a page title, every thing work ok when i use NSPrintOperation to display a print panel.
but i need…

Nayef
- 463
- 5
- 13
1
vote
1 answer
How to add header using NSPrintOperation?
I want to print the content of myWebView with header and footer (page numbers) for my Mac OSX app. So far, I am able to print the content of myWebView using the following code (from this link Printing multiple pages in Objective-C).
-…

DORI
- 54
- 1
- 8
1
vote
0 answers
EDSDK callbacks not working after NSPrintPanel/NSPrintOperation Displayed
I am currently developing an application using the Canon EDSDK to access my DSLR that will directly print the shot images. The problem here is, that my code interfacing with the EDSDK works perfectly until my application displays either a…

Grassi
- 91
- 1
- 7
1
vote
1 answer
EXC_BAD_ACCESS when trying to print
So, I'm trying to test the printing function and I keep getting a EXC_BAD_ACCESS error pointing me at this part of the code :
[op runOperationModalForWindow:(NSWindow*)[core window]
delegate:self
…

Dr.Kameleon
- 22,532
- 20
- 115
- 223