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.
I have made a variety of changes to org.openide.text.DefaultPrintable to handle the following 2 problems-- 1) Very large files would cause OutOfMemory errors because all the AttributedCharacterIterators were created up-front. 2) When printing on Windows, very large jobs would be spooled to the printer because TextLayout's draw method is highly inefficient. Also, the quality of the printouts is not very good. I fixed the first problem by not storing all the AttributedCharacterIterators (or TextLayouts), and instead asking for them as needed. I solved the second problem by avoiding TextLayout's draw method and instead breaking up the lines of text into regions that are all the same Color and Font, and then calling the Graphics2D drawString method. This results in postscript files that spool very quickly and are often 1/10th the size (and have better resolution). I wanted to contribute my changes to be used in a future version of NetBeans. Note that it probably won't compile as-is, because I had to remove some references to company- specific code. However, the modifications to solve the 2 problems mentioned in this report are all present in the TextPrintable class.
Created attachment 11439 [details] Interface for printing.
Created attachment 11440 [details] Code that actually does the printing.
reassigned to openide/editor
Thank you very much. To be honest I do not have any resources planned at the moment for the text package. If your paches would be tuned and tested and I could just commited them I would simply do that. If there is some more work to do then I will leave this issue open and apply patches as time permits (probably not very soon). Btw. the whole package is a bit buggy and we are talking about the cleanup as part of which this should be definitely fixed. But that is also future which is not clear at the moment. Anyway, thanx for your interest and patch.
Reassigning to new module owner mslama.