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 35785 - Improvements to DefaultPrintable to avoid memory problems and huge files
Summary: Improvements to DefaultPrintable to avoid memory problems and huge files
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-26 15:24 UTC by cahrens
Modified: 2010-01-12 05:20 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Interface for printing. (2.50 KB, text/plain)
2003-08-26 15:25 UTC, cahrens
Details
Code that actually does the printing. (35.03 KB, text/plain)
2003-08-26 15:25 UTC, cahrens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cahrens 2003-08-26 15:24:16 UTC
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.
Comment 1 cahrens 2003-08-26 15:25:00 UTC
Created attachment 11439 [details]
Interface for printing.
Comment 2 cahrens 2003-08-26 15:25:32 UTC
Created attachment 11440 [details]
Code that actually does the printing.
Comment 3 pzajac 2003-08-26 15:43:48 UTC
reassigned to openide/editor
Comment 4 David Konecny 2003-09-01 13:59:44 UTC
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.
Comment 5 Antonin Nebuzelsky 2008-04-17 15:14:55 UTC
Reassigning to new module owner mslama.