Perform Save for Styled Text and images

I have build a text editor
I am using a JTextPane
but facing a problem with saving and opening the files with Styled text and images.
Can any body help me out with a sample code
Thank you

Hi,
If you want to save the file so that only your application can read the contents back, then you can serialize the Document of the JTextPane to the file and then read it back. This is the simplest approach.
Serialize myTextPane.getDocument(); and while opening do
Deserialize Document
StyledDocument myDocument = stream.readObject();
myTextPane.setDocument(myDocument);
and you are done, irrespective of whether text pane contains only text or images or any other combination.
Regards,
[email protected]

Similar Messages

  • How scan a text document and save as editable text not image

    I have a new ENVY 5660 and a macbook pro running yosemite.  When I scan a text document and try to save it, I am only given a choice of image formats.  How can I save it as an editable text in pages or word?

    Hi , Welcome to the HP Forums! I see that you are wondering how to scan a text document, and save as editable text, and not a image, with your HP Envy 5660, on Mac OS X 10.10. I am happy to look into this for you!  According to your printer's specifications, it states: NOTE: Integrated OCR software is available only with Officejet 5740 and 8040 models. Which means, this software is not included with this printer. You might be able to perform this operation, if you are able to get third-party OCR software. Such as: ReadIris.  Hope this answers your question!  “Please click the Thumbs up icon below to thank me for responding.”

  • Resizing text and images with actions and keeping it resized for the next slides, how to?

    Hello everybody,
    I searched over the net and in this support section for a solution to my problem, but i didnt find any, so...here I am asking you experts.
    Through a particular use of different actions I make a logo "compose" in the first slide of my presentation (the logo is composed by text and images that interact), then in the second slide i make it resize so it goes 50% of its size and moves down like a TV logo, in the corner of the slide, and I want it to stay there for all the lenght of the presentation.
    It might be a stupid problem, but I didnt understand how to keep it there, 50% of its size and always in that position. If i duplicate the slide I obviously duplicate the 100%-size-logo, not its 50%-size-version, and if i shrink it in order to make it be 50% of its size the text size doesnt shrink so i have to change the text size manually, but the visual effect is imperfect.
    Lets summarize:
    slide 1: text appears, image appears, the text and the image move and "compose" the logo
    slide 2: the complete logo reduces its size to 50% and moves in the lower corner of the presentation, in the place I want it to be for, lets say, 20 slides
    slide 3: i want to have this logo already reduced in size and in its position, in the right lower corner, but if i try to group the different parts of the composed logo and i try to squeeze them the font doesnt change its size, I only squeeze the area that the text occupies.
    Some help please guys?
    Thanks in advance,
    Dom-
    (add: the problem is kind of similar to this: https://discussions.apple.com/message/9179367#9179367 . the idea of making a slide that contains the logo and text in the exact positions they would be after the move and scale actions is good and that was my first attempt, the probem is that it looks impossible to me to create a second "little" version of the logo that looks exactly the same of the first one that i reduced, so i hope there is some way to tell the app to use "the first logo, only resized the way i want", and thats the point where the problem with the size of the text comes out)

    Hi pritam,
    The “maintain proportions of window for different monitor
    resolutions” property will maintain the proportional size of the front panel
    (its x and y sizes) when opened in a different resolution. The front panel
    objects will not be resized and will appear larger (and may not fit inside the
    front panel) when saved in a higher resolution, and moved to a lower
    resolution. You can use the “Keep window proportions” property to achieve the
    same results.
    To have both the front panel dimensions and front panel
    controls scale, you need to have both the above property and the “scale all
    objects on front panel as the window resizes” selected. The labels will not be
    resized by this.
    I tried using both properties on two monitors and noticed
    that the change does not occur when the resolutions between the monitors are
    different. I had to lower both monitors’ resolution to see the change work
    properly.
    Please post back if you have any questions. Have a great day!
    Ryan D.
    District Sales Manager for Boston & Northern New England
    National Instruments

  • Scrolling Text and Images in Flash CS3

    I am pretty new to Flash and I have spent all day trying to
    look up tutorials on making it possible to scroll text and images
    in Flash but none of them are working for me. I know you save the
    content into a movie clip but that's as far as i have gotten. would
    anyone be able to walk me through this PLEASE???
    Thanks,
    Peter

    You could use a Swing HTMLPANE or draw it all onto a
    BufferedImage and display that (code posted under 2D graphics thread).
    MArk

  • Saving text and image

    I have an application where I need to save both text and image.
    this is controlled by the menu
    when I press save I want to be able to save either a text file or an image file.
    How can I do this.
    below is a sample of what I have been trying
    else if (source == menuSave)
    //             File.getName().toLowerCase().endsWith(".jpg");
               saveimage();
    //           if(File.getName().toLowerCase().endsWith(".txt"))
               savetext();both saveimage() and savetext() are independent functions

    I have an application where I need to save both text
    and image.
    this is controlled by the menu
    when I press save I want to be able to save either a
    text file or an image file.
    How can I do this.
    below is a sample of what I have been trying
    else if (source == menuSave)
                 File.getName().toLowerCase().endsWith(".jpg");
    saveimage();
    if(File.getName().toLowerCase().endsWith(".txt"))
    savetext();both saveimage() and savetext() are independent
    functionsFor saveimage, I think you could use ImageIO#write() method.
    For savetext, you could use simple PrintWriter.

  • Paste selected text AND images from a webpage to Pages/Word?

    I'm a new Mac user (also running virtual Windows XP via vmware fusion), and I know next to nothing about my Mac. Please bear with me if this is something that has been answered (I looked, but didn't find a specific answer for my question...it may be here, but I can't find it).
    On a Windows-based PC, all I need to do is select, copy, then paste into a Word document. All text and images would paste. I can't seem to figure out how to do that in Pages or Word (have MS Office for Mac, too).
    Thanks for any help.

    I suppose I was hoping I could do on my Mac, what I did on my Dell...that doesn't appear to be the case.
    Specifically, I'm talking about clicking/dragging to select what I want (including images), opening a Word document then pasting everying, including ALL selected images. More specifically, at sites with game walkthroughs. I prefer to save them to a document and refer to them offline, if I need to. I actually tried it at 2 different sites (one that hosts their own images and one that does not), with the same results.
    While I was waiting for a response (thank you, so much, by the way), I tried again and actually managed to get the first 3 images (of 60+) to paste into Word. There were blank places in Word, but the invisible images were clickable. In Pages, only the text pasted.
    Tried it every which way, but Sunday, LOL, and nothing worked. If it can't be done on my Mac, then I'll just keep using my Dell (I knew there was a reason I decided to keep it) for that sort of thing and then email them to myself...or try installing my MS Office '07 under virtual Windows.
    Thanks, again.

  • When I click "edit" to manage content on a web page, I see code instead of text and images. How can I fix this?

    I edit content on www.fomh.org. Until recently, I could sign in as administrator, click "edit" in the editable area of a web page, and proceed to update text and images. I have been using Firefox to do this for several years. Now when I attempt to do this, I see all the html code in the editable area instead of the text and images.
    I am using Mac OS 10.6.8

    What is the content of that window?
    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    *Use a compressed image type like PNG or JPG to save the screenshot
    *Make sure that you do not exceed the maximum size of 1 MB
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How can i copy line with text and image to ms word

    When I insert an image in textflow using InlineGraphicElement it works, but when I copy the line with the image to MS Word it copies only the text (not the image).
    How can i copy the image to MS Word?

    If you want copy formatted text and image to MS Word, you need to give MS Word rtf markup, because Word can recognize rtf markup but not TLF markup.
    So you need to create a custom clipboard to paste a rtf markup. It's a large feature for you, because you need a tlf-rtf converter in your custom clipboard.
    TLF Custom Clipboard Example:
    package
        import flash.display.Sprite;
        import flash.desktop.ClipboardFormats;
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.conversion.ITextImporter;
        import flashx.textLayout.conversion.TextConverter;
        import flashx.textLayout.edit.EditManager;
        import flashx.textLayout.elements.*;
        import flashx.undo.UndoManager;
        // Example code to install a custom clipboard format. This one installs at the front of the list (overriding all later formats)
        // and adds a handler for plain text that strips out all consonants (everything except aeiou).
        public class CustomClipboardFormat extends Sprite
            public function CustomClipboardFormat()
                var textFlow:TextFlow = setup();
                TextConverter.addFormatAt(0, "vowelsOnly_extraList", VowelsOnlyImporter, AdditionalListExporter, "air:text" /* it's a converter for cliboard */);
            private const markup:String = '<TextFlow whiteSpaceCollapse="preserve" version="2.0.0" xmlns="http://ns.adobe.com/textLayout/2008"><p><span color=\"0x00ff00\">Anything you paste will have all consonants removed.</span></p></TextFlow>';
            private function setup():TextFlow
                var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT);
                var textFlow:TextFlow = importer.importToFlow(markup);
                textFlow.flowComposer.addController(new ContainerController(this,500,200));
                textFlow.interactionManager = new EditManager(new UndoManager());
                textFlow.flowComposer.updateAllControllers();
                return textFlow;
    import flashx.textLayout.conversion.ITextExporter;
    import flashx.textLayout.conversion.ConverterBase;
    import flashx.textLayout.conversion.ITextImporter;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.elements.IConfiguration;
    import flashx.textLayout.elements.TextFlow;
    class VowelsOnlyImporter extends ConverterBase implements ITextImporter
        protected var _config:IConfiguration = null;
        /** Constructor */
        public function VowelsOnlyImporter()
            super();
        public function importToFlow(source:Object):TextFlow
            if (source is String)
                var firstChar:String = (source as String).charAt(0);
                firstChar = firstChar.toLowerCase();
                // This filter only applies if the first character is a vowel
                if (firstChar == 'a' || firstChar == 'i' || firstChar == 'e' || firstChar == 'o' || firstChar == 'u')
                    var pattern:RegExp = /([b-df-hj-np-tv-z])*/g;
                    source = source.replace(pattern, "");
                    var importer:ITextImporter = TextConverter.getImporter(TextConverter.PLAIN_TEXT_FORMAT);
                    importer.useClipboardAnnotations = this.useClipboardAnnotations;
                    importer.configuration = _config;
                    return importer.importToFlow(source);
            return null;
        public function get configuration():IConfiguration
            return _config;
        public function set configuration(value:IConfiguration):void
            _config = value;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.ListElement;
    import flashx.textLayout.elements.ListItemElement;
    class AdditionalListExporter extends ConverterBase implements ITextExporter
        /** Constructor */
        public function AdditionalListExporter()   
            super();
        public function export(source:TextFlow, conversionType:String):Object
            if (source is TextFlow)
                source.getChildAt(source.numChildren - 1).setStyle(MERGE_TO_NEXT_ON_PASTE, false);
                var list:ListElement = new ListElement();
                var item1:ListItemElement = new ListItemElement();
                var item2:ListItemElement = new ListItemElement();
                var para1:ParagraphElement = new ParagraphElement();
                var para2:ParagraphElement = new ParagraphElement();
                var span1:SpanElement = new SpanElement();
                span1.text = "ab";
                var span2:SpanElement = new SpanElement();
                span2.text = "cd";
                list.addChild(item1);
                list.addChild(item2);
                item1.addChild(para1);
                para1.addChild(span1);
                item2.addChild(para2);
                para2.addChild(span2);
                source.addChild(list);
                var exporter:ITextExporter = TextConverter.getExporter(TextConverter.TEXT_LAYOUT_FORMAT);
                exporter.useClipboardAnnotations = this.useClipboardAnnotations;
                return exporter.export(source, conversionType);   
            return null;

  • How can i create a simple netweaver portal page that shows text and images?

    Hi,
    i have a simple question or maybe it's not so simple.
    I am completly new to SAP Netweaver 2004s Portal. At the moment i'm trying to understand the struture of the whole thing. I already know how to create roles, worksets and pages and i know how to combine the different elements so a user can acces them.
    And now i want to create a simple portal page that shows text and images. Is it possible to create such a simple page with the portal content studio? What iView do i have to use?
    (I just want to create a start page with a welcome text on it.)

    Marc
    Considering that you would any ways go ahead with complex development from this simple start page I recommend create a Web dynpro Iview for your start page (include the Iview in your page).
    For putting the contents use Netweaver Developer studio to build a simple start page application and put your static text on that Iview.
    Please go through the following log after your NWDS development is over - This will make you comfortable for further challenging work.
    http://help.sap.com/saphelp_erp2005/helpdata/en/b7/ca934257a5c96ae10000000a155106/frameset.htm
    Do reward points if this helps and let me know of you want anything more.

  • Printing text and images together on a single page (printjob)

    Hello all,
    how am I able to print both text and images on the same page (defined by one printjob), using the javax.print API?
    It seems that one printjob (one page) can have only one flavor, that is text, or GIF, or JPEG, etc. Since the majority of print jobs out there usually require text and graphics on the same sheet this seems a bit strange.
    I have resorted on creating a PDF file through the iText library, and then printing by converting to GIF (quality is significantly reduced though, not an option), or by using the Acrobat Reader command line from java (looks dangerous for batch printing). My printer does not support printing directly using the PDF flavour.
    So, I solved the problem by converting to PDF, but printing is still cumbersome. Any other ideas?
    Thank you for your time,
    Ari.

    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Need help with adding formatted text and images to Crystal Report?

    Here's my scenario:
    I have a customer statement that's generated as a crystal report and that has a placeholder for advertisement. The advertisement is mixture of formatted text and images. Until now we only had one advertisement that was always used on the report. The new requirement is that we would have a pool of hundreds of advertisements and would need to display one specific advertisement on the customer statement based on various marketing criteria. They key is that the advertisement content will be determined programmatically and cannot be hardcoded into the report. I'm using Crystal2008 with .net SDK.
    Here are the solutions I thought of, but I'm still rather lost and would appreciate your help/opinion.
    1) Pass HTML or RTF to the report
    Not really sure if this is possible and how to get it done. Also how would I pass in images? Would display formatting be reliable when exporting to PDF?
    2) Create each add as a subreport and append it programatically
    I actually have this working, but I only know how to append a new section to the end of the report and then load the subreport to the section. I have no other controll of the placement. Is there a way to dynamically load a subreport to a predefined section in the main report? How about adding a dummy subreport in the main report as a placeholder and then replacing it with a different subreport? How could I do this?
    3) Pass an Image to the report
    I would create each advertisement as an image and then would somehow add the image to the report. How would I load the image and control the placement? Could I somehow define a placeholder for the image in the main report-maybe a dummy image to be replaced?
    Thank you.

    Hello Pavel,
    I would got the third way.
    You can use dynamic images in your report.
    Just by changing the URL to the image the image can be changed.
    Please see the [Crystal Manual|http://help.sap.com/businessobject/product_guides/cr2008/en/xir3_cr_usergde_en.pdf] and search for images.
    or directly here
    [Setting a Dynamic Graphic Location Path on an Image Object|https://boc.sdn.sap.com/node/506]
    [Dynamic image and HTTP://|https://boc.sdn.sap.com/node/3646]
    [codesample for .NET|https://boc.sdn.sap.com/node/6000]
    Please also use
    [Crystal Reports 2008 SDK Documentation and Sample Code|https://boc.sdn.sap.com/developer/library/CR2008SDK]
    [Crystal Reports 2008 .NET SDK Tutorial Samples|https://boc.sdn.sap.com/node/6203]
    Hope this helps
    Falk

  • Is the BSP extension better than this solution(Text and Image in Button)?

    Hi guys,
    I have a  concept question to decide whether a BSP extension is needed.
    I want to put text and image in htmlb button, and used the solution like below:
    <%
      data image type ref to cl_htmlb_image.
      data: image_string type string.
      create object image.
      image->id = 'back'.
      image->src = cl_bsp_mimes=>sap_icon( id = '@9S@' ).
      image->tooltip = 'Go back'.
      clear image_string.
      image_string = image->IF_BSP_BEE~RENDER_TO_STRING( page_context ).
            %>
            <xhtmlb:toolbarButton id      = "back"
                                  onClick = "back"
                                  text    = "<%= image_string %>" />
    But this solution is not desired by customer, since they don't think it looks nice. So is it possible to create my own BSP extension to get a nicer element?
    Thanks for any hint.
    Regards,
    Liying

    Hi,
    By a nicer element...did you mean to display a better image...or a nicer image ????
    if yes, the you can upload any image you need and then use it here...
    Tell me if you need more information...!!
    Hope this helps.
    <b><i>Do reward each useful answer..!</i></b>
    Thanks,
    Tatvagna.

  • Box containing text and image (fit frame to contents).

    Hi all,
    The best way I can describe what I am trying to achieve is to show you a picture.
    So essentially, I'm looking to create a grey box, containing some text with an image floating to the right hand side. I want about 2mm space (padding) inside the grey box so no content goes right to the edge and I want the text to wrap around the image. The bit I'm finding tricky is when I go to use the 'Fit frame to content' option. I'm trying to remove the space indicated by the red arrows but if I anchor the image inside the text frame, the grey box shrinks to the height of the text and the image overflows.
    This would be incredibly simple to achieve on the web, am I doing something wrong?
    Any help/direction would be greatly appreciated.

    Sorry, been out for an hour.
    I understood that you want to have some variable height text frame (the gray box), and that this box should reduce in height to fit the text contained therein, but not  less than necessary for the bottom to be 2mm below the bottom edge of the variable height image (which I'm presuming is anchored to the first line of text in the frame) in a case where there is not sufficient text for fit frame to content to avoide making the frame shorter than the bottom of the image.
    I believe this could be scripted, but that will still require you to run the script. You should ask over in InDesign Scripting
    As far as a container that holds both text and image frames, yes, but only if you "paste into" a new frame after creating the two separately and grouping, which probably is not what you have in mind.

  • Disappearing text and image

    I created letterhead in Pages for my lil brothers film production company. Saved. Exported the document to Word. Sent it to him. So far so good. Looks great. Each time he opens the document in WORD and trie to alter the text by selecting and typing over it both the text and the graphics disappear.
    Is there any way to correct this? I really love the letterhead and have been having problems recreating it in other software.

    Thanks for a quick response. I see yr point. The thing is I am setting up a table cell editor and a renderer. It is easy to set up the editor with a combo box. For the renderer, I am using a default cell renderer and I want to make it look like a combo box as well. Since the default cell renderer extends JLabel, I do something like
    comboBoxRenderer = new DefaultTableCellRenderer();
    ImageIcon image = new ImageIcon("image/Play16.gif");
    comboBoxRenderer.setIcon(image);
    comboBoxRenderer.setHorizontalTextPosition(JLabel.LEADING);
    which does not get me the effect I want. I can put more pixels between the text and image using setIconTextGap. But it is not fool proof. I think I will try yr approach, but then it gets a little complicated. Would have been good if there is simpler way. I will appreciate yr thoughts

  • Text and Image component Image placing not working!

    Hi Guys,
    For some odd reason, when I drop text and image component to the page I do not see the left or right option to place image in "Styles" tab.  The styles tab shows blank and by default paragraph gets placed after image.  This only happens in my site, not in Geomatrix. Am I missing something to include??
    Thanks in advance.

    geometrixx site has extended the text&image component thats why it shows that option. earlier in 5.4 version they directly overrided in geometrixx apps but now you wont find it there. But if you want to achieve this functionality then you have to override same component locally in your apps and add some more configuration to style tab as below.
    <tab4
                jcr:primaryType="cq:Widget"
                xtype="componentstyles">
                <items jcr:primaryType="cq:WidgetCollection">
                    <controlstyle
                        jcr:primaryType="cq:Widget"
                        fieldLable="ControlStyle"
                        name="./ControlStyle"
                        title="ControlStyle"
                        type="select"
                        xtype="selection">
                        <options jcr:primaryType="cq:WidgetCollection">
                            <Left
                                jcr:primaryType="nt:unstructured"
                                text="Left Align"
                                value="left"/>
                            <Right
                                jcr:primaryType="nt:unstructured"
                                text="Right Align"
                                value="right"/>
                        </options>
                    </controlstyle>
                </items>
            </tab4>

Maybe you are looking for

  • How to set fixed size for JTextField?????????

    you can create a textfield like JTextField text=new JTextField(8); here the constructor takes 8 as the width of textfield , not the size, if you type more the 8 characters, it takes it happily, i need that it only takes 8 characters, not more then th

  • How do I making a photo slideshow then subsequently buring to DVD?

    I have just purchased PSE Premier 12 thinking I could make a photo slideshow then burn it to DVD. However it appears that I can only make a video/movie type presentation which results in terribel graphics (blurs what are actually very sharp photos) a

  • How to Call Same Adaptive RFC across different Backend R/3 Systems

    Hi Everyone, I have been troubled for the last 3 or 4 days on how I should develop Web DynPro code to call the same RFC on different backend R/3 systems.  Don't really want to maintain my own Jco connects within a SAP Connector project and I don't re

  • Why Save Images as .bmp?

    Just looking at all my project folders, we have hundreds and hundreds of screen captures that are .bmp format. I did my own test saving the same screen capture in different formats - .bmp, .jpg, and .gif. Results: .bmp is 955 KB, .jpg is 76 KB, and .

  • Newbie requires a few pointers to get started

    Just starting out on the Mac and the development off (I've chosen Cocoa and got a book 'Learning Cocoa with Objective-C), and I'm trying to get my head around where to start. I'm not new to development, I'm currently a Java developer amongst other, a