This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 166950

Summary: Source from editor is not printed in NetBeans on Mac OS X
Product: editor Reporter: tomwheeler <tomwheeler>
Component: Painting & PrintingAssignee: Miloslav Metelka <mmetelka>
Status: NEW ---    
Severity: blocker CC: Gary.A.Peach
Priority: P4    
Version: 7.4   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Attachments: Log file from session in which Java source and plain text files did not print
Screen shot of editor

Description tomwheeler 2009-06-11 22:34:03 UTC
I am filing this on behalf of the developers here who is using 6.7 RC2 on a MacBook Pro running Java 6 under Mac OS X

He has recently begun using NetBeans for a project and went to print the source code for a Java file.  He clicked to put
focus in the editor window for this file, then clicked the File menu and selected Print.  The print preview window came
up but was empty and the Print button on the bottom of this screen was disabled.  There was no error message displayed.

I verified that he had printers set up, so this is not the problem.  He has since verified that he also experiences the
same problem in NetBeans 6.5.1 and can reproduce it while running NetBeans under either Java 5 or Java 6.

Fellow NetBeans DreamTeam member Caoyuan Deng has a similar configuration and has verified for me that printing works as
expected under a similar configuration (NetBeans 6.7 RC2, Mac OS X 10.5.7 and the current version of JDK 6 as
distributed by Apple).  Therefore, this problem obviously affects only certain machines, although in the case of my
colleague, it is reproducible 100% of the time on an affected configuration.
Comment 1 Vladimir Yaroslavskiy 2009-06-12 10:24:39 UTC
*** Issue 166876 has been marked as a duplicate of this issue. ***
Comment 2 Vladimir Yaroslavskiy 2009-06-12 10:28:49 UTC
I tried on my Mac, everything works fine.

Can you please try to print another view:
open NetBeans with Welcome screen, select it
and invoke printing. What is the result?

What is the result if "File > Print to Html"
is invoked for a source code?
Comment 3 tomwheeler 2009-06-12 16:24:39 UTC
I have had him try "Print to HTML" for a Java source file; this worked as expected.  I also had him try to print the
welcome screen (Help -> Start Page).  This also worked as expected.  Therefore, it seems the problem may be limited to
printing from a source editor window.
Comment 4 Vladimir Yaroslavskiy 2009-06-18 14:07:05 UTC
Looks like that org.netbeans.editor.BaseDocument.print(printContainer, usePrintColoringMap, lineNumberEnabled,
startOffset, endOffset) passes nothing to the printContainer, so the pages are empty.
Comment 5 Vitezslav Stejskal 2009-06-18 14:39:39 UTC
Umm, suspicious, if I'm not mistaken print HTML works the same way as Print and so both should behave the same... Does
this happen for all your files? Can you attach here the <nb-userdir>/var/log/message.log file? Thanks
Comment 6 tomwheeler 2009-06-18 16:33:17 UTC
The developer whose machine exhibits this problem is on vacation until next Tuesday, so I cannot get a copy of the log
file until then.  However, I do know that he has this problem with any Java file he's tried to print (and he tried it
with several different files).  I cannot say whether this affects source files of a non-Java type (e.g. HTML, CSS,
properties, etc.), but he was able to "Print to HTML" successfully using a Java source file while not able to print to a
actual printer using that same file.

I will attach a copy of the logfile when he returns next week.
Comment 7 Vitezslav Stejskal 2009-06-18 16:54:05 UTC
Thanks Tom.
Comment 8 tomwheeler 2009-06-23 18:05:18 UTC
My colleague is back in the office and I had him try a few things.  He was able to reproduce this with a newly-installed
version of 6.7 RC3 (he was previously able to reproduce this using 6.7 RC2 and 6.5.1).  His only modification to the
version of NetBeans was to edit the etc/netbeans.conf file to force the use of Java 6.  

He was unable to print from a Java source file; he tried a few different ones as I watched.  For each, he selected the
Java file's node in the project tab and clicked File->Print.  He also attempted to print by opening the files in the
editor window, explicitly clicking in the editor window to give it focus and then selecting File->Print.  In all cases,
the Print Preview window came up but its content area was blank as previously described.  He was able to reproduce this
for a plain text (.txt extension) file.

However, we did have a bit of a breakthrough.  By chance, we found that printing *did* work if he first closed all
editor windows.  Here are the exact steps under which printing worked:

1.  Select the Window -> Close all documents menu item

2.  Select node for Java file in the project tab

3.  Select the File -> Print menu item

4.  Print Preview window is displayed and shows a rendering of the source file's contents as expected.

I will attach his messages.log file, although it does not seem to contain anything of interest.  
Comment 9 tomwheeler 2009-06-23 18:06:39 UTC
Created attachment 83952 [details]
Log file from session in which Java source and plain text files did not print
Comment 10 Vitezslav Stejskal 2009-06-24 15:35:57 UTC
Interesting, thanks Tom for analyzing this.
Comment 11 tomwheeler 2009-06-29 18:17:26 UTC
My colleague also just noticed that print preview is *not* blank when there is at least some text selected in the editor
window.  Specifically, the print preview works as expected if you invoke Edit -> Select All before invoking File ->
Print.  If you select just a few lines of text first, then the print preview will shows just those lines rather than the
whole source file.  Selecting a few characters is not enough to make the print preview not appear blank -- it seems you
must select at least one newline in order for something to show up in the print preview.

He noticed this behavior in the 6.7 Java SE final release on the same Macbook Pro on which he noticed the previous behavior.
Comment 12 tomwheeler 2009-08-19 15:57:29 UTC
Why exactly is this now marked INCOMPLETE?  

I understand it may be difficult to track down, but I have gone out of my way to provide every single bit of 
information I've been asked for, plus some more information I thought might be helpful.  Please tell me specifically 
what information you need?
Comment 13 Jiri Prox 2009-08-20 10:25:22 UTC
The issue is not INCOMPLETE, you've provided all info you've been asked for, that's why I've removed the INCOMPLETE keyword.
Comment 14 dekskinner 2009-09-01 11:07:58 UTC

Standard install of Netbeans 6.7 on OS X 10.5.8 working fine.

On upgrading to Snow Leopard OS X 10.6.0 I suddenly see this issue too. I can see Start Page fine but any files that
were previously open I see no text in the Editor whatsoever. I can see html tags from a jsp in the Navigator. I can see
warning indictors down the right hand side of the Editor, I can even see the markers for code folds in the Editor but no
text. Opening other files jsps, java source I see no text either.

Even creating a new file in an existing project and typing in code I see no text at all. 

I saw that Netbeans was running in 64 bit java as is the default with 10.6.0. I changed the default setting in
Utilities/Java Preferences to run both Java Applet Plugins and Java Applications in 32 bit but still no joy.

I downloaded and upgraded to 6.7.1 still no joy in 64 bit or 32 bit Java.

I have no other platform on which to test another OS but I believe this to be OS X related due to the fact it happened
after an OS upgrade.

I would like to see the priority of this issue increased to P2 or even P1 as I cannot even edit code which is a core
requirement of any IDE.

I am willing to post any log files, config files etc as requested. 


Derek Skinner.
Comment 15 dekskinner 2009-09-01 11:10:38 UTC
Posted screen shot.
Comment 16 dekskinner 2009-09-01 15:24:50 UTC
Created attachment 86922 [details]
Screen shot of editor
Comment 17 dekskinner 2009-09-01 15:32:46 UTC
Sorry, I've just read this again and see that this is relates solely to a printing issue.

I don't know why but I read it as relating to the editor issue I was experiencing. 

I will create a new Issue.


Comment 18 Vitezslav Stejskal 2009-10-23 11:57:25 UTC
Is this still a problem? I just tried on my Mac with 6.8dev build and it seemed to work fine. Although the behavior of
File -> Print is slightly different if you have the file opened in the editor comparing to when all editors are closed
and you just select the file's node in Projects View.

Product Version: NetBeans IDE Dev (Build 091022)
Java: 1.6.0_15; Java HotSpot(TM) 64-Bit Server VM 14.1-b02-92
System: Mac OS X version 10.5.8 running on x86_64; MacRoman; en_US (nb)
Comment 19 tomwheeler 2009-10-26 17:12:28 UTC
Yes, it's still an issue though I realize it does not affect everyone. 

What's strange is that this person experienced it first under Leopard on one Mac, but has since bought a new one and
also upgraded to Snow Leopard.  It happens even on the new machine.  I probably wouldn't have believed it if I had not
seen it for myself.
Comment 20 David Strupl 2012-10-25 13:39:11 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 21 stevensrmiller 2013-05-16 19:09:35 UTC
I am using NB 7.2 under Windows 7 (64-bit). Having very similar problem. "Print Preview" opens when I choose "File/Print," but it shows no text and the Print button is disabled. None of the work-arounds mentioned here have any effect.

Is this bug currently reported under another number?
Comment 22 stevensrmiller 2013-05-17 18:45:39 UTC
I have entered this as Bug 229888, under NB 7.2 and Windows 7 x64.
Comment 23 marcush 2014-04-29 03:30:02 UTC
I am using a Mac 10.9 and am having the same issues reported.  I wish to print the source code with its color.  When printing directly I get a nice black and whgite copy.  When selecting print options and then "print as in editor"  i see the colors displayed correctly.  When printing this I end up with a blank page of text but a background in color.  This was reported in 2009 it's now 2014 have I missed something?  Am I in the correct area for reporting issues?
Comment 24 peter.ivarsson 2016-04-28 10:22:44 UTC

I have the same problem, the page is empty and can't be printed.

I am using Netbaens 8.1 on a Mac.
It is only Netbaens that have problem to  print.


Modellnamn:	MacBook Pro
Modellidentifierare:	MacBookPro11,3

Systemversion:	OS X 10.11.4 (15E65)
/ Peter