Menu

Editor / Preview

Help
k-rueffer
2007-08-01
2013-04-10
  • k-rueffer

    k-rueffer - 2007-08-01

    Is there any possible way of creating a Print and to define an Grid or whatever as Editable. What I am looking for is a combination of the Preview component with an Editor?

     
    • Matthew Hall

      Matthew Hall - 2007-08-01

      I'm afraid you're on your own here.  I wouldn't know where to start.

       
    • k-rueffer

      k-rueffer - 2007-09-06

      Hey,

      I'll downgrade my problem a little bit.
      I am Using a JTextarea respectively a JEditor to enter Text. What I need is to fit the width of the text to the printed text.
      As a result, the typed text should look just like printed text.
      Is there an Easy way to do this???

       
      • Matthew Hall

        Matthew Hall - 2007-09-06

        If you're trying to coerce a JTextArea to layout text just like TextPrint, I don't have good news.  The problem is that TextPrint (and all the other Print classes) actually rely on the system printer to determine layout: the same font can render completely differently depending on platform, printer drivers, and what fonts the printer has built-in.  Because of this the line wrapping and even page wrapping can be dramatically affected.  To duplicate this you would essentially have to copy and paste all the calculations inside the TextIterator class (which is in TextPrint.java) to your own code.  Plus the fact that you're using Swing for editing and SWT for printing makes this even more complicated.

         
    • k-rueffer

      k-rueffer - 2007-09-07

      THX for your quick reply!!!
      I'll thought, tht it'll be easy. The Swing app was almost finished wehen I read about paperclips. That's why I mangled two very differnet systems. Using SWT as "Printservice" and Swing as GUI seems to work just fine. I'll have to think about something different.

      Is the a setting for justified text within a textprint?

       
      • Matthew Hall

        Matthew Hall - 2007-09-07

        I'm not sure if this will get you any closer to editor/printer integration, but take a look at ReportCat.  ReportCat is a printing library which uses the Swing/AWT printing APIs.  It's a commercial product, but if you can find a way to integrate it, it may be worth a look:
        http://www.netcat.li/java-report-printing-library/

        I had a work project that was originally in Swing.  When we decided to migrate it to SWT+JFace, I wanted to migrate the printing to SWT as well.  Call it a pet project (plus printing in SWT is loads faster).  So I went over the APIs in ReportCat to see it worked, and then created an analogous API for SWT.  That's how the PaperClips got started.

        There is no support for justified text in PaperClips, however there is a feature request open for it:
        https://sourceforge.net/tracker/index.php?func=detail&aid=1771448&group_id=148509&atid=771875

        I'm still trying to work out how to justify text in a way that shared code between TextPrint and StyledTextPrint though.  Unless you've got any ideas or are willing to hash it out yourself and contribute your code back to the project, it's not likely this will be accomplished in the near future.  :-/

        Matthew

         
    • k-rueffer

      k-rueffer - 2007-09-07

      My Idea right now is zhat I am using an textpane with justified text, which will fit just about into the printable grid. Then I iterate line after line. This way i'LL don't have to worry about lne breaks. Page Breaks aren't a problem.
      If some code worthy of being published emerges I'll let you know. Again, thank you very much for your hints.
      BTW, reportcat really looks nice - i'll check into it.

       

Log in to post a comment.

MongoDB Logo MongoDB