 |
 |
Help evaluating Mac OS X with Java
|
 |
|
 |
|
Junior Member
Join Date: Sep 2000
Location: Paris, France
Status:
Offline
|
|
Hi,
I need to do a presentation to help make OS X our choice for Java dev against Wintel. I'd like to ask if somebody can post a trivial howTo (if possible) for direct PDF printing under Cocoa.
A simple project printing a text view would be of great help.
Regards
Barty

|
|
Veni, Vidi, Barty !
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
Are you talking about using the Cocoa framework through Java, or pure (portable) Java programming?
Through Cocoa, it's easy -- just call print() on the text view, which brings up the print panel, etc. If you just want to grab the actual PDF, then look at the NSPrintOperation.PDFOperationWithViewInsideRect() methods, which lets you write the PDF data (into an NSMutableData object) for a particular region in any (Cocoa) view without bringing up the print panel.
I'm not familiar enough with printing in pure Java to know how easy/hard that is...
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Sep 2000
Location: Paris, France
Status:
Offline
|
|
ThanX for the reply
>>>>>>&a mp;gt;>
Are you talking about using the Cocoa framework through Java, or pure (portable) Java programming?
>>>>>>&a mp;gt;>
Yes, that's it !
>>>>>>&a mp;gt;>
Through Cocoa, it's easy -- just call print() on the text view, which brings up the print panel, etc. If you just want to grab the actual PDF, then look at the NSPrintOperation.PDFOperationWithViewInsideRect() methods, which lets you write the PDF data (into an NSMutableData object) for a particular region in any (Cocoa) view without bringing up the print panel.
>>>>>>&a mp;gt;>
That's what is was reading bf4, but i need a way to print to pdf to a specified path on disk without any printing dialog. Any clue ?
Regards
Barty
|
|
Veni, Vidi, Barty !
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
NSMutableData data = new NSMutableData();
NSPrintOperation op;
op = NSPrintOperation.PDFOperationWithViewInsideRect(.. ., data);
if (op.runOperation())
data.writeToURL(someFileURL);
I don't think the print panel should show up but if it does just put
op.setShowsPanels(false);
in there.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|