RTFEditorKit is it worth using it.

Hello.
Its been well documented that a RTFEditorkit does not save(persist) images,tables using a JTextPane.
Does anybody have a solution to this or is it worth using it at all.
Feedback appreciated.

You asked for solution.
The code to save/load images below.
If you want to develop your own RTFEditorKit I'll be glad to answer questions.
regards,
Stas
    protected void writeIcon(Element leaf, Writer out) throws IOException {
        AttributeSet attr = leaf.getAttributes();
        ImageIcon icon = (ImageIcon) StyleConstants.getIcon(attr);
        int w = StyleConstants.getIcon(attr).getIconWidth();
        int h = StyleConstants.getIcon(attr).getIconHeight();
        if (icon != null) {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
             * perform saving as PNG image It's MS Word approach to images. PNG
             * format is used because of free licensing of PNG format.
            ImageEncoder pe = ImageCodec.createImageEncoder("PNG", os, null);
            BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            bi.getGraphics().drawImage(icon.getImage(), 0, 0, null);
            pe.encode(bi);
            byte[] ba = os.toByteArray();
            int len = ba.length;
            int i;
            StringBuffer sb = new StringBuffer(len * 2);
            for (i = 0; i < len; i++) {
                String sByte = Integer.toHexString(ba[i] & 0xFF);
                if (sByte.length() < 2) {
                    sb.append('0' + sByte);
                } else {
                    sb.append(sByte);
            String s = sb.toString();
            out.write("{\\pict\\pngblip ");
            out.write(s);
            out.write("}");
    protected void insertImage(String content) {
        int len = content.length();
        //converts to binary representation
        byte[] buf = new byte[len / 2];
        for (int j = 0; j < len / 2; j++) {
            byte b1 = get16(content.charAt(j * 2));
            byte b2 = get16(content.charAt(j * 2 + 1));
            buf[j] = (byte) (b1 * 16 + b2);
        //creates image from binary
        Image img = Toolkit.getDefaultToolkit().createImage(buf);
        ImageIcon icon = new ImageIcon();
        icon.setImage(img);
        if ((icon.getIconHeight() < 0) || (icon.getIconWidth() < 0)) {
            return;
        MutableAttributeSet attr = new DefaultBajtextAttributeSet();
        StyleConstants.setIcon(attr, icon);
        //inserts image in the document
            document.insertString(currentOffset, " ", attr);
            currentOffset++;

Similar Messages

  • Is it worth using select query on infotype tables

    Hi Experts,
    I might be posting in the wrong column, but i just need to know is it worth using a select query on Infotype tables (PAxxxx)?? or should we prefer using the function modules for data fetching?
    If select is not suggested, what is the reason for that?
    Rgds
    Prateek

    Hi ,
    Its not said that u cant write select on PAXXXX tables . Yes of couse LDB are there to fetch the data but it depends on
    the requirement when to write a select and when to consider using in LDB .
    Generally when you are looking at say 8 to 10 tables of infotypes with free selection , then LDB is suggested to fetch the data .
    if you are looking to fetch the data for say some tables for a restricted selection (where clause) then select is used .
    If i want to write a program using select only then fetching data from infotypes tables for large no of records will lead to
    more time consumption which becomes easier in LDB as they are fetched in hierarchy level based on keys .
    Normally it will be a combination of LDB and select querys  in the development scenario
    Br,
    Vijay.

  • Real-time Blacklist (RBL) Servers are they worth using?

    Hi, are Real-time Blacklist (RBL) Servers worth using, and if so what's the best once to use?
    Thanks
    - Cameron

    I agree with Joe. Using just Spamhaus is a pretty good approach. Spamhaus is reasonably conservative about blacklisting servers, so it is less likely that you will reject legitimate servers (which can happen with some more aggressive RBLs).
    Also, if you are serious about this, download and carefully follow Pterobyte's "Frontline Defense for Mac OSX Server" <http://osx.topicdesk.com/content/view/38/62/>. By implementing his tutorial, you will be fine tuning your server so that it rejects about 70% - 80% of spam before it reaching your content filter. It increases the efficiency of your setup a great deal.

  • S.M.A.R.T. - Worth using? BIOS and/or OS

    Having had 4 IBM 60GXP drives fail in 18 months (luckily they were all part of mirrored RAID setups), I now keep a closer eye on my drives.
    I've got S.M.A.R.T. enabled in BIOS but so far it's not told me a thing. I assume it will just give me a message if and when a drive is on the brink of total failure? Anyone know for sure how this works? I guess there's no point in disabling it anyway, apart from maybe minimally faster boot times?
    I've also been looking at a couple of XP utilities which give all the S.M.A.R.T. information - Active SMART (http://www.ariolic.com/activesmart/) and DiskCheckup (http://www.passmark.com/products/diskcheckup.htm). Active SMART costs £15 and will actually tell you as different values change. DiskCheckup is free but only lists the values, it doesn't seem to actually warn you if anything looks bad.
    Does anyone else actually keep an eye on S.M.A.R.T.? Are there any other utilities worth trying?
    By the way, I use the Promise SATA controller if I check S.M.A.R.T. - with the VIA controller I get nonsense values back, like my 74Gb Raptor being 2143Gb!!

    I'm not running the IBM's anymore, the whole lot died!  
    I initially setup 2 PCs with 2 GXP60s each. When 2 of the 4 died I RMA'd the drives and got replacements. Now all 4 originals are dead and both of the replacements are scratch disks as they have intermittent problems.
    My local server now has mirrored raid with 2 160Gb Western Digitals, and my desktop is running from a single Raptor 74Gb.
    I initially installed the SMART utilities to keep an eye on drive temperatures (which incidentally range from 21 to 28C sitting behind the fans in Lian Li cases). I've just left it running on the desktop to give me a bit of prior warning if the drive is degrading now it's not mirrored.
    Why do you say "it slows things down too much"? The BIOS check at startup isn't noticeable, and Active SMART has a 250K footprint and by default only monitors the drives once an hour.

  • Eithernet Speed is it worth using Gigabit 1000MBS?

    Most folks ethernet system runs on 100Mbs I believe over Cat5 cable.
    On the HH3 is a Gigabit output  which offers speeds up to 1000Mbs.
    Is it worth getting a new gigabit network card to utilkise this port. Would I see any visible differance in speed on downloads or streaming?

    Do you have any recommendations for cheap GigE switches? And what sort of speeds are you seeing between machines?
    I get about 20 megabytes per second between my PC and Popcorn media player, but they are linked directly using my second network port on my motherboard, I then have the 2 ports on the PC in bridged mode so that the Popcorn can still connect to the net through the PC, which is then connected to the HH3 along with all the consoles and stuff. The main draw back of that method though is that the PC must be left on when wanting to use the Popcorn to view Youtube etc.
    Cheers, Andy.

  • IMac G4, is SSD drive worth using in it?

    Basically I'm wondering if there would be any benefit using an SSD over a mechanical drive.  I have a Western Digital Scorpio Blue WD5000BEVT 500GB 5400 RPM and a ocz agility 3.  Besides the difference in sound, would both of these perform the same?

    Hi, if you can find a compatable SSD and SATA->IDE adapter, you would notice a small speed increase, less in 10.4.11 than 10.5.8, & much of the increase will be eaten up by the slow Bus speed, most noticeable would be Boot times likely.

  • Blu Ray burning: is it worth using multipass option?

    Does it make sense to use "Multipass" option on Blu Ray setting using only one computer?
    Is there visible difference from "not-Multipass" burning?

    IMO, yes.
    2 Pass will always give better quality than 1 Pass. The question is how noticeable it will be. The more movement in your movie, the more Compressor's analysis pass can ensure it's encoded correctly.
    2 Pass will always take longer than 1 Pass – in fact, twice as long.
    And no one would say that 2 Pass looks twice as good.
    So if you had a very tight deadline, you would be justified in choosing 1 Pass. But if you have the time (like overnight), there certainly is no downside…and there is some upside.
    Do a test on a short, challenging section and judge for yourself.
    Russ

  • OWB 10.2 Design questions - OLAP objects - worth using? too buggy?

    I am designing a 2 tiered data warehouse. I have a staging schema where numerous staging tables and key mapping tables are kept and a data warehouse schema where I have relationally implemented dimensions and cubes. I want the dw layer to be made up of conformed dimensions and facts as per Kimball.
    For the DW layer, my plan was to create cubes and dimensions which would be implemented as ROLAP. I would then selectively create MOLAP cubes for subsets of the data warehouse.
    My first question - does this much make sense or should I avoid the logical constructs of dimensions and cubes like the plague and simply build star schemas as Oracle tables directly?
    Assuming I can use cubes and dimensions - how do I control the column names for the cube foreign keys? I have one cube with several date dimension foreign keys. Using the cube editor I get nonsensical names like time_dim_key, time_dim_key1, time_dim_key2. I want these to be creation_date_fk, expiration_date_fk, etc so that they are readable. I don't see any way with the cube editor to control this.
    Also, please see my other posts about errors with the role concept on dimensions.
    And lastly, have any of you had success in deploying a large scale DW with OWB using dimensions and cubes?

    So far the verdict is TOO BUGGY. There is a documented bug in metalink:
    DATA COLLECTED
    ===============
    Deployment output
    ATLAS_TIME_DIM
    Create Error
    ORA-06550: line 960, column 95:
    PLS-00123: program too large (Diana nodes)
    ISSUE CLARIFICATION
    ====================
    Dimension deployment (with 5 or more roles) results in a PLS-00123 error.
    ISSUE VERIFICATION
    ===================
    Verified the issue by the deployment output which show the PLS-00123 error.
    CAUSE DETERMINATION
    ====================
    Defect in OWB 10g R2
    CAUSE JUSTIFICATION
    ====================
    Bug 5066108 (CWM2 CODE GEN USES A SINGLE ANONYMOUS PLSQL BLOCK)
    POTENTIAL SOLUTION(S)
    ======================
    Possible workarounds:
    Reduce the number of roles associated with the dimension.
    Use relational vs. multidimensional
    POTENTIAL SOLUTION JUSTIFICATION(S)
    ====================================
    Deployment is successful with fewer roles associated.
    Looking at the recommended solutions it appears that I can:
    1) limit the cube to very few dimensions making it useless for anything major
    2) Use relational - My first interpretation of this was that I could generate the cube but use the "data objects only" deployment. No such luck. When the roles are added to the cube, the designer window locks up when the roles exceed 8 for the time dimension.
    So, the "use relational" workaround seems to imply that cubes and dimensions should be avoided. Anyone have any contrary experiences?
    Specifically has anyone done any of the following successfully with OWB 10.2:
    1. Have you implemented a time dimension with more than 10 roles associated with it?
    2. Have you implemented a cube (relationally or otherwise) with more than 5 roles of a single dimension against it?
    3. Have you implemented a cube with more than 10 dimensions of any kind associated with it?

  • HT2509 Why has apple not ditch font book yet? The software causes more problems than it is worth using.

    How can I ditch font book and remove from my computer? It causes nothing but problems and I prefer to use Font Reserve which runs smooth on my Macbook Pro with Retina.

    iOS4 has been working fine for me.
    What troubleshooting have you done?
    As far as the app, have you contacted the developer to let them know that their game crashes in iOS4?

  • Slow widgets...not worth using anymore

    recently, my widgets started acting up. two i use all the time now are very slow to respond. one allows me to print envelopes, it can search my address book and return addresses. The other is for a quick fax for FaxSTF.
    they both take a long time to type in, then stop text entry for a bit then resume again. anyone ever heard of this.
    i have and do repair permissions often, i run some auto maintence scripts and i shut down every night.

    Please post Photoshop Elements related queries over at
    http://forums.adobe.com/community/photoshop_elements

  • Migration Assistant - worth using?

    Dudes,
    Am just about to upgrade to a Unibody Macbook from a white MacBook and need to move all my stuff over.
    The last time I did a transfer was when I went from a G4 iBook to the MacBook, and I meticulously copied over all the files and data I had using FW. Which took forever. And I had to redo all my settings too. I'm not sure whether I should have used Migration Assistant then, but I certainly have heard a lot more people talking about it now to give it some consideration for the new move.
    Is it a reliable way to move all your data over? Does it really transfer all your files and data and settings? Does it leave anything behind (either in a good way, like caches, or bad way like stuff you might want to keep but have saved in an obscure location)?
    Any thoughts/feedback/info appreciated.
    Needless to say I'll backup using TM before I do anything and both Macs are/will be running Leopard.
    One final question - sometimes it's good to start afresh when getting a new computer / OS, like a clean install. Would using MA to move everything over still maintain this "freshness/newness" of the new Mac, or will it overwrite everything from the crudded up OS on the old MacBook to the new MacBook? Hard to explain, but I'm sure some of you know what I mean
    Thanks!
    JC

    So is it better to install all your apps fresh, then?
    Yes. You should go to their web-sites and get the latest versions.
    That's a shame as I was hoping that MA would cut out pretty much all the work of transfering my data from the old MB to the new one.
    So it's OK for data (and user settings, prefs etc I presume) but not for much else?
    The last time I used it, I let it move the applications, since I new they were all the latest versions. Most worked, but some were not able to do certain operations because some files did not have the special settings needed.
    Is email included in your user files?
    Yes, but the first time you use Mail it will rebuild its database to include all the old mail.

  • Is it worth using Pattern here?

    Hi Folks,
    I have an application where a certain object is used by many JSPs or Servlets. While using objects, its hard to keep track of the status of that object. Because of that, JSPs and Servlets end up using that objects when its state is not valid to be referenced and throws expception. is there any Pattern that might help keep track the state of objects? or do i necessarily use a Pattern in situation like this? I would appreciate if you could provide some suggestion in regards to this situation. Thanks.

    Not sure what makes your object be in an invalid state. However, you figure that out you could just provide a method called: isValid() returns boolean

  • I have a dual boot system. Windows xp and Windows 7. Photoshop elements 7 would not run on Windows 7, so I purchased Elements 13. Slow as christmas. Not worth using at the speed it takes to do work on photos

    I have a dual boot system, xp pro and 7 pro. Photoshop elements 7 runs fine on xp, but would not run on windows 7. Bought elements 13, Very, Very slow. To slow to work on photographs. I have bought new ram and done every other optimize ideas I have found online.
    Any ideas.  Asus anthlon 64 x 2, 4g ram, m2n e motherboard, NVidia video card, 2+ g processor

    Please post Photoshop Elements related queries over at
    http://forums.adobe.com/community/photoshop_elements

  • HT5622 I did not choose "use icloud" option for my initial setup.  so, it is creating for not enough space in my ipad.  How do I go back and set up icloud to store data?

    I did not choose "use icloud" option for storing during my initial setup.  How can I reset icloud account, so it can be used for storing.

    Welcome to Apple Support Communities
    If you are planning on using iCloud to store files, forget about iCloud and use a cloud storage service like SkyDrive or Dropbox. iCloud is focused on information sync between the iPhone, iPad, iPod touch, Mac and PC instead of storing files like MobileMe. It's not worth using iCloud for this.
    If you still want to set up iCloud, open Settings > iCloud, log in with your Apple ID and follow its steps

  • Can I use my iPod to move photos and music from one computer to another?

    Hi,
    Is it possible to have photos and music on my iPod from one computer, and then copy those from my iPod to another computer? (like with an ordinary USB-unit)
    And another question: Is it possible to download movies onto my iPod? If yes, how? (owner of an iPod 30GB)
    Thanks!

    Did you set it to copy full-resolution photos??? If so, enable your iPod for disk use, open my computer, click on your iPod, and open the pictures folder. You can just drag them from there. If you didn't, use a program such a CopyPod Photo (google it) to copy photos from your iPod. Note that the files will only be the same resolution as your iPod screen (320x240) and not worth using for anything else. If you want to use it for sharing, definitely go with the full-res option. It is at the bottom of the photos pane in the iPod screen in iTunes.

Maybe you are looking for

  • Calling stored procedure in OCCI

    Hi, Guys. I triy to call stored procedure in Oracle database server.But i have problems with taking of the OUT parameters. How to call the procedure corectly? Depend on Oracle manual everything is fine but as we see that is not. Here is the 2 lines t

  • How to do Delta upload and consolidate in SSM, how to use transformer.ini

    Hi, Can anybody explain me how to do Delta data upload and also how to do delta data consolidation in SAP SSM. Also how can i create and use transformer.ini file. Thanks and reagrds Edited by: Himanshu Bisla on Mar 25, 2009 2:09 PM

  • Safari page is grayed out

    New iPad, worked flawlessly from the start.  Now Safari page is grayed out, cannot move the displayed page, can enter web address in address bar but cannot select anyting on the page.  Ideas?  I have a feeling it's something simple.  Thanks!!

  • Re-installing Adobe Elements 5

    When I try to start Photoshop Elements 5, I get the following error message. MEM - PhotoshopElementsOrganizer.exe:  PhotoshopElementsOrganizer.exe - Application Error The instructions at "0x000aafff" referenced memory at "0x000ab000". The memory coul

  • MacBook software update after OS X 10.5.8?

    I have a white MacBook running Mac OS X Version 10.5.8 and when I check for a software update, it says there isn't one.  My computer meets the requirements for Snow Leopard but I can't download it because it says it requires OS X 10.6.  I also can't