Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Help evaluating Mac OS X with Java

Help evaluating Mac OS X with Java
Thread Tools
Junior Member
Join Date: Sep 2000
Location: Paris, France
Status: Offline
Reply With Quote
Nov 5, 2001, 10:51 AM
 
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
Reply With Quote
Nov 5, 2001, 08:49 PM
 
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
Reply With Quote
Nov 6, 2001, 08:04 AM
 
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
Reply With Quote
Nov 6, 2001, 11:58 AM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:58 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2