Inserting image in rtf doc
Hi all,
i am trying to make my own rtf editor , I've read the most of the toppics in this forum on this issue,
but I'm stucked on inserting the hex Data into the document.
Do I actually need to override ImageView?
I found a method in RTFReader (instantiated from read(InputStream in,...)) handleBinaryBlob(byte[] data).
RTFReader is private, so I cannot override this method. Should I override the read method in
RTFEditorKit and then call the read method in DefaultEditorKit, or I could just use the doc.insertString(...) with the binary data inside of the overriden RTFEditorKit read method? I will lose the functionallity of the RTFParser this way.
I know I should override read and write methods but how?
So could somebody help me on this?
The code for creating the binary data from buffered image and creating the Icon from StanislavL follows:
ImageIcon icon=(ImageIcon)StyleConstants.getIcon(attr);
if (icon!=null) {
int w=StyleConstants.getIcon(attr).getIconWidth();
int h=StyleConstants.getIcon(attr).getIconHeight();
ByteArrayOutputStream os=new ByteArrayOutputStream();
PNGCodec p=new PNGCodec();
ImageEncoder pe=p.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,i;
StringBuffer sb=new StringBuffer(len*2);
for (i=0;i<len;i++) {
String sByte=Integer.toHexString((int)ba & 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("}");
extracting image
String content; //<- image representation
int len=content.length();
//converts to binary representation
byte[] buf=new byte[len/2];
for (int j=0; j<len/2 ;j++) {
String c1=content.substring(j*2,j*2+1);
String c2=content.substring(j*2+1,j*2+2);
byte b1=Byte.parseByte(c1,16);
byte b2=Byte.parseByte(c2,16);
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 SimpleAttributeSet();
StyleConstants.setIcon(attr,icon);
//inserts image in the document
document.insertString(currentOffset," ",attr);
currentOffset++;
I guess these two functions must be implied into the overriden EditKit write and read methods.
Could somebody give me a start idea?
regards
rumpi
Thanks for reply.
It did't helped me a lot or I'dont really understand your idea.
What you say in your postings is build my own reader and writer.
For example to open a rtf file in my jeditorpane I must read from
the input stream each byte and reimplementing AbstractFilter, RTFParser and RTFReader
I could get all headers like \par or \pic and then rtfDoc.insertString(pos, "the label content", attr) with the attributes extracted from header.
When that is the only way I am asking myself what are the swing people for?!?!
I'll try to do that myself, so I'm not asking for code but I would appreciate
some detailed info about it. For example when I dont use RTFReader anymore
I loose everything what I've got untill now. So I should read every byte opening a file
and check like in RTFParser if the first character is "\", then the next couple of bytes
untill I get the header. Then I should check which labels(text) is this header for(until the next header), so
I could insert a string with the according attribute set? For Icon when I get the
\pic header I read the byte sequence and build the picture just like you wrote.
My Editor is an applet so I've hoped I wouldn't send too much code to the client
so reimplementing RTFParser, Reader... would slow it down, but whatever.
Thats really a lot of work only because the given classes are not extendable, grrrr.
Viravan, thanks for the fast reply , but like I said , I 've already read all relevant
postings in this forum and didnt found something really helpful. I already read all
tutorials and articles from sun about this issue and I still have the feeling I'm a freshman
in this area.
I'm still angry with the swing team about it, this bug is noted since 2001 I think. grrr
regards
rumpi
Similar Messages
-
Insert Image in RTF Template Conditionally
Can an image be inserted into an RTF Template using an If-Then statement? Like this:
<?if:FIELD1='IMAGE1' 'insert IMAGE1' else 'insert IMAGE2'?>
If this is possible what syntax needs to be where the example says 'insert IMAGE1'? The images are jpg files that exist on a local PC but the template will run on a Unix machine.
Is there a way to do this? Thank you very much.
Jamesyou can try like this
<?template:image?>
<?if:FIELD1='IMAGE1'?>
IMAGE1
<?end if?>
<?if:FIELD1!='IMAGE1'?>
IMAGE2
<?end if?>
<?end template?>
use this tag where u need image <?call:image?>
for image location or dynamic images check these links
https://blogs.oracle.com/xmlpublisher/entry/dynamic_images
https://blogs.oracle.com/xmlpublisher/entry/one_of_our_images_is_missing
http://learnobi.blogspot.com/2012/08/dynamic-image-in-rtf-of-oracle-bi.html
Signature image on template -
Images in RTF file do not display in WordPad
I inserted some images into a flowdocument, then save it as a rtf file.
Image photo = new Image();
BitmapImage photoFile = new BitmapImage();
photoFile.BeginInit();
photoFile.UriSource = new Uri("image.bmp", UriKind.Relative);
photoFile.EndInit();
photo.Source =photoFile;
Paragraph pPhoto = new Paragraph();
pPhoto.Inlines.Add(photo);
flowdoc.Blocks.Add(pPhoto);
When I open the rtf file with wordpad, all the images are lost. But they can be displayed in Word.
Why does that happen?
Thx.WordPad (at least version 6.1 on W7) cannot display linked images, MSWord can. WordPad
can display embedded images. But the format seems to be some uncompressed WindowsMetaFile8 format, which may increase the storage footprint, compared to eg. PNG graphics, drastically. (Open a Wordpad RTF in Notepad, you'll see...)
A cross-check against the DotNET 1.1 RTF control shows the same as in Wordpad, linked images do not show up. That leads to the assumption that Windows Forms as well as Wordpad are based on the Windows Common RTF Control, and that control seems
not to support linked images.
I'm not quite sure yet, but WPF converts RTF content to XAML (which is very similar to HTML), so it does not rely on the Windows RTF common control, thus linked images in RTF are not a problem there.
HTH
Ulrich -
How can i display image in RTF template when Oracle Apps running in Windows
Can any body help how can i display image in RTF template when oracle apps running in Windows Server.
Thanks
RaviHi Ravi,
You can add images into your rtf template using MS Word Insert Picture feature.
Did you try this method?
Thanks
Ravi
[email protected] -
how to insert image to JTree(not the leaficon, openicon, closeicon image) ?
example:
// JTree
A1 imaage A
--A1.1 Image B
B1 Image c
--B1.1 image dDid you read the tutorial?
You might also want to read this: [Concepts: Editors and Renderers |http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender] -
Hi,
I'm trying to insert an image into the database using a BLOB datatype. I'm using PHP right now to code everything. I was wondering if anybody has resolved any of the errors I've gotten, or knows how to insert images into the database. I don't have intermedia. Thanks...
$filename = "/u1/apache/docs/image.gif";
$binary_file = addslashes(fread(fopen($filename, "r"), filesize($filename)));
$sql_stmt .= "INSERT INTO mdi_err_image (err_id, err_image) VALUES ($err_id, '$binary_file')";
$stmt = ociParse($conn, $sql_stmt);
ociExecute($stmt);
ORA-00972: Identifier too long (when I pass in a larger gif file)
ORA-01465: invalid hex number error. (when I pass in a really small gif file)Hi there,
I might know... But maybe your questions is not so clear... I don't know if I see what you want to do...
Do you want to have an image in a shape causing wrapping and apply a picture frame or so to it?
If so:
1. Make your shape and put text in it
2. Drop the image into iWeb
3. Being sure it is selected copy it
4. Go into your shape and paste your image into it
5. Open up the Inspector and make the image wrap
6. Again in the Inspector apply picture frames or whatever
Thus you apply picture frames when it already is in the shape, not before.
Regards,
Cédric -
My colleague recently had Office 2007 installed, then RH 7.
She started a new project and imported a Word *.docx file. RH
did everything I expect it to do except for this:
The images do not appear in the topics. It creates a separate
project manager folder for the images, as I expect it to do.
However, the folder seems to contain nothing. Normally, I
would expect to see images listed there. They aren't in the top
directory as baggage files, either. They are in .gif and .jpg
formats.
The images do show up in the project's Windows directory, in
the new folder corresponding to the "empty" directory in project
manager. The Unused Files report finds them.
I can't figure out what my colleague may have done when built
the Word .doc -- nothing any different from what I usually do --
that could explain this. Saving it as .docx or as .doc makes no
difference. Converting it from .docx to .doc doesn't fix it. The
import goes exactly the same on my two PCs. One runs Office 2007
and RH 7. The other runs Word 2003 and RH 7. Of course, .docx won't
run in the latter environment. Any .docx or .doc files that I built
work fine.
I found two workarounds, but first I'd really like to know
what conditions in her Word files would cause RH to do this. Has
anyone seen it, and is there a simple way to fix the Word doc?
Otherwise these are her options:
Option 1. Create a new Word document in Word 2007 and insert
the complete original file (the new Word menu moved this to Insert
> Object > Text from File). Save the new file as .doc or
.docx. Import the new file into RH 7. Images appear in the topics
and in the project manager under a new folder. (Copy all and paste
into the new Word doc also works.)
She has several large Word documents to deal with, so this is
less than ideal.
Option 2. In the new topics in RH, insert the images where
they belong. While they don't appear in the project manager, the
insert image dialog finds them. After we insert an image, RH shows
it in the project manager. Probably, this would take longer than
Option 1.
Any ideas?
HarveyNext time you have trouble importing a legacy Word .doc, try
this:
In Word, create a new file using the New command and the
default .dot.
Insert the contents of the legacy .doc from the menu command
(not by cutting and pasting).
In Word 7, they moved the "insert file" command to Insert
> Object > Text from File . . .
I'd think "insert text from file" would mean pasting
something that doesn't include graphics. However, Word will bring
in everything from the legacy .doc including formatting and styles.
Save As . . . the new document as .doc or .docx. I don't
think RH 7 cares. In our experience, jpegs and gifs sometimes were
missing until we created the new Word file.
Another wrinkle: In Explorer view, with a folder open, File
> New allows you to create an empty Word document right there.
We had some trouble using one of these for importing and saving the
legacy .doc.
Didn't have time to track it down. Was the legacy .doc
created in Word 2003, and the conversion to .docx in 2007 glitched
some images? In your case, it just happened to the .png files? As
you previously speculated, images may have been handled differently
in creating the original .doc.
My hypothesis here is, whatever the reason for images getting
lost in the import to Word, everything gets fixed -- even for pngs
-- when you start with a clean slate in a new Word document created
from the New menu in Word.
Harvey -
Inserting images in forum message?
Hi,
Is it possible to insert attached images inline in the forum messages (similar to what you can do in the wiki pages)
We in our organization are using forum which comes with portal.
Regards,
AmitHi Amit,
its not possible to insert images in forum text, but you can attach images,docs to the forum message. To change attached files size,number of attachments and type you should have forum administrator role.
Forums come with portal are jive forums , you can check administration guides on jive forums in Google.
Regards,
Mahesh. -
Hi
If I open example: header.php and insert any photo jpeg/.html ecs i can see the images in the split screen but not in the browser if i save then refresh. I am able to make any change to the code ecs. and they are reflected just fine. I have tried this with my fireworks images .html and when that did not work i tried a strait jpeg off the desktop. This all did not work. I have deleted the local server then step by step created a new one via devnet instruction. This did not work! everything looks fine i even tried in 3 sep browsers with 0 luck....There is no remote server connected at this time because i am making a child theme for my current site. After all changes are done we will the ftp the word press files to site and change.
Ps i even started over from scratch with 0 positive affects....After a lot of pain!!!!!!! the issue is fixed lol After 3 weeks I have overlooked the obvious !!! so the simple fix was the path of the image. Yes i feel stupid 10 years in lol....
Apparently dreamweaver cs 5 will not use the full path when inserting images into the page example: If you drag the image out of your assets folder or however you do it, DW will give you a path like this <img src="images/glass.jpg" width="800" height="729"> This is not the full path and when your pist!!! you cant see things like that ;( so the image path should look like this:
<img src="wp-content/themes/adszoom/images/glass.jpg" width="800" height="729">
also in the html files example of bad then good!
<!--======================== BEGIN COPYING THE HTML HERE ==========================-->
<img name="navigation" src="navigation.gif" width="1000" height="50" border="0" usemap="#m_navigation" alt="">
<map name="m_navigation">
<area shape="poly" coords="804,7,994,7,994,47,804,47,804,7" href="http://adszoom.com/699-2/" title="SEARCH BY CATEGORIES FOR CLASSIFIED ADS" alt="SEARCH BY CATEGORIES FOR CLASSIFIED ADS" >
<area shape="poly" coords="602,8,792,8,792,48,602,48,602,8" href="http://adszoom.com/wp-admin/edit.php/" title="VIEW OR EDIT YOUR CLASSIFIED ADS" alt="VIEW OR EDIT YOUR CLASSIFIED ADS" >
<area shape="poly" coords="405,8,595,8,595,48,405,48,405,8" href="http://adszoom.com/post-an-ad/" title="NEW CLASSIFIED AD POST" alt="NEW CLASSIFIED AD POST" >
<area shape="poly" coords="206,8,396,8,396,48,206,48,206,8" href="http://adszoom.com/help/" title="HELP WITH YOUR CLASSIFIED ADS" alt="HELP WITH YOUR CLASSIFIED ADS" >
<area shape="poly" coords="3,9,193,9,193,49,3,49,3,9" href="http://adszoom.com/" title="HOME VIEW CLASSIFIED ADS" alt="HOME VIEW CLASSIFIED ADS" >
</map>
<!--========================= STOP COPYING THE HTML HERE =========================-->
</body>
NOW THE GOOD!
<!--======================== BEGIN COPYING THE HTML HERE ==========================-->
<img name="navigation" src="wp-content/themes/adszoom/images/navigation.gif" width="1000" height="50" border="0" usemap="#m_navigation" alt="">
<map name="m_navigation">
<area shape="poly" coords="804,7,994,7,994,47,804,47,804,7" href="http://adszoom.com/699-2/" title="SEARCH BY CATEGORIES FOR CLASSIFIED ADS" alt="SEARCH BY CATEGORIES FOR CLASSIFIED ADS" >
<area shape="poly" coords="602,8,792,8,792,48,602,48,602,8" href="http://adszoom.com/wp-admin/edit.php/" title="VIEW OR EDIT YOUR CLASSIFIED ADS" alt="VIEW OR EDIT YOUR CLASSIFIED ADS" >
<area shape="poly" coords="405,8,595,8,595,48,405,48,405,8" href="http://adszoom.com/post-an-ad/" title="NEW CLASSIFIED AD POST" alt="NEW CLASSIFIED AD POST" >
<area shape="poly" coords="206,8,396,8,396,48,206,48,206,8" href="http://adszoom.com/help/" title="HELP WITH YOUR CLASSIFIED ADS" alt="HELP WITH YOUR CLASSIFIED ADS" >
<area shape="poly" coords="3,9,193,9,193,49,3,49,3,9" href="http://adszoom.com/" title="HOME VIEW CLASSIFIED ADS" alt="HOME VIEW CLASSIFIED ADS" >
</map>
<!--========================= STOP COPYING THE HTML HERE =========================-->
</body>
THIS LINE IS YOUR ISSUE
<img name="navigation" src="wp-content/themes/adszoom/images/navigation.gif" width="1000" height="50" border="0" usemap="#m_navigation" alt="">
Ok thanks and if there are any issues with dw please ask: [email protected] -
When inserting image how do I force inline CSS not image tags?
When I insert an image to my page layout it always uses html width= and height= tags
e.g. <img src="images/wordpress.jpg" width="125" height="112">
This is driving me nuts
(I thought these tags were pretty old fashioned for current doctypes. Why does dreamweaver continue to use them?)
I want inserted images to be shown with inline CSS
e.g. <img src="images/wordpress.jpg" style="width:125px; height:112px;">
I can then more easily add more CSS like padding, floats etc as needed.
Any ideas how I set this up as a default or quickly convert?
(I dont really want to add lots of unique image classes to a style sheet)
many thanks!
Dreamweaver CS6Image height & width values are not deprecated. Unless you're building a responsive web site, it is usually better to have these attributes stated in the HTML.
But when I don't want them, I do the following:
Insert > Image > browse to file...
On the properties panel, I delete the width and height values, hit Enter.
Nancy O. -
Adobe premiere elements 12 - how to create menu bar action for my inserted image button
adobe premiere elements 12 - how to create menu bar action for my inserted image button without using their movie menu theme
forbemag
I do not think that I am completely focused into this completely, so let us see if the following is going to help.
You are going to need a base for your button. When you mention "image" button, I am assuming that you are using that term to differentiate between a text button and a thumbnail type button.
The menus (main and scene) take their origin in .psd files on the hard drive and strict nomenclature and structure for Layers Palatte. And, the buttons on the menus trace back to the menu markers on the Timeline, main menu marker and order of placement of scene markers. The scene thumbnail will only appear when there is a scene marker on the Timeline to which it.
In view of all that
Where have you already inserted this "image (button)"...into the Layers Palette of a Photoshop document or other? Is this "image (button)" in a structured Layer Group in the Layers Palette with sublayer groups, text layers, graphic/background layer"?
Let me give you an example
If you have a button (with thumbnail) on the main menu and you want that to open to a specific scene in your movie, then you use a main menu marker on the Timeline at the spot that you want that button to target.
If I am getting closer to what you seek, then please further clarify the DVD navigational envisioned scheme.
Thanks.
ATR
Add On...I did not see the exchanges between us and SG until after I had posted mine. I thought that your discussions were concluded. Please excuse the interruption. -
Insert Link and Insert Image broken in Chrome
The Insert Link and Insert Image buttons have been broken in my Chrome for at least the last couple of days (latest version, 32.0.1700.72 m, Windows 7 64).
When you click one of the buttons, the overlay window appears with a title, but it is otherwise black with no contents. (See screenshot below.)
The buttons work fine in Firefox. What hasn't helped: deleting cookies, clearing the browser cache, waiting for several minutes for their content to appear.Whtat are we supposed to Claudio? All descend on Adobe with clubs and try to beat some sense into someone!
The fact is the customer is no longer the prime concern. Most companies don't give a Rats behind (toned down to prevent censors action) about the customers. It's the almighty dollar. Screw as many customers as they can while they can and line their pockets with all the green backs as they can while they can. Then if the cusomers leave so be they take their money and run.
Customer use to have power, they would speak loud and frequently and get things fixed. And what with people from other countries now owning US companies, That were brought up with different moral compasses. They have no concept of this thing of loyalty to customers. The customer can jump off a cliff and they will simply cheer them on while the do so.
We have lost, the fight can't be won. It no use. So Pat and others are right.
I've been trying for 15 years for adobe to fix the issue of having multiple Pdfs created from Office documents because the claim they can't figure out how MS does Page and section breaks. And the issue of Weblinks not being active when converted to PDF's Both on Mac's yet on PC's there is no issue. I quite this year after I received a down right nasty not from Adobe say they didn't have any interest in fixing the bugs and were not about to try. What it amounted was go take a flying leap.
They have the ability. They have beenblaming Its apple because they don't do such and such , or Microsoft because they don't do so and such. On the Links issue Saying MS doesn't provided the necessary hooks in the mac version of Office. They do you can take a Word document created on a Mac and open a PC and create a PDF and the links will be active. You can Open a Word Document in Apple's pages and all links created in Office document will be there. The argument has been proven several different ways to be a an outright bald-faced lie. The defect is squarely with the Mac version of Acrobat.
So Pat and others are right. Just throw in that towel. Adobe support of its customers is now 10 times worse than intuit's which is supposed have the lowest reputation of any software compny that ever existed. -
I have just downloaded Mac OS X 10.9 and Pages 5. When I open any pre-existing document in the new Pages the format is zoomed to 125%, the headers are out of position, the margins are changes, and inserted images are also relocated. What can I do?
Have you tried resetting the SMC ? > Resetting the System Management Controller (SMC)
-
Problem in insert image function
Hi there...I'm brand, spanking new to Dreamweaver CS3, and I
just started working through tutorials to try to learn the
software. I'm having a little issue with something that is problem
very easily fixable to the gurus here.
When I tell Dreamweaver to "insert image" through the Common
Bar, it takes me straight to the accessibility dialog. When I click
OK, it then puts a small box with no image on the page. I then have
to double click the box to tell it what image to place into the
image holder. This doesn't seem correct to me as I'm duplicating
steps. It's becoming annoying when I'm working with several images.
The tutorial I'm using shows another dialog box asking for the
image BEFORE the accessibility dialog box. It's not working this
way for me.
Can you help?
Thanks!
KymThis is definitely an odd issue. Have you tried installing
any extensions to DW? If so, uninstall them and see if the function
works.
If not try just try inserting an image by clicking the
drop-down arrow next to the insert image button and then click to
insert an image and see if it takes you to the right screen.
If that doesn't work you may need to try re-installing the
program. I would suggest some other OS specific things you can do
such as trashing the preferences file from the Mac OSX library, but
I don't know what OS you are using so it wouldn't help to tell you
these steps as at this point it might just be more beneficial to do
a re-install. -
Inserting images in a collapsible panel
Can anybody help with a problem about inserting an image into
the tab of a collapsible panel as a visual clue to users that they
can open/close the panel? I'm trying to ensure that users don't
just see the tab of the panel as a kind of good looking heading but
that the images (two - one for open, one for closed) would give a
visual clue that the tab actually opens when clicked.
I'd be very grateful for any help, thanks, st44By managing the table's default cellpadding and cellspacing.
Are you
setting them to zero?
If that's not happening then we would need to see your code.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"OxfordFishSalon" <[email protected]> wrote
in message
news:fulior$9i1$[email protected]..
> When I insert images in a table and align them right,
for example, there
> are
> still a few pixels between the edge of the table and the
image on the top
> and
> right.
>
> How do I make an image go to the absolute edge of a
table?
>
> Thanks,
> Chris
>
Maybe you are looking for
-
Hello All, I am using OO - ALV in which I am displaying a quantity field.This field is an editable field and if user tries to change the value and SAVE , it is taking some wrong values. Say suppose I am having 1.000 as the initial value and if
-
Hi team. I have a 4.6 C version an the import / export works fine. But in the SAP ERP Central Component 5.0 I do the Export. Review the abap memory and se the areas, but empty. And when I do the import the data are clear. Do you have any idea. And i
-
Set two views in one portal page
Hello all, I need to set two views in one portal page, or tow deferent views have to be setted in one view, unfortunately i didn't find anythings in SAP forums about this subject please help me to reso
-
Why can I not see audiobook purchases on my itunes purchases?
where do I find my audiobook purchases on itunes?
-
I'm from Albania and I want to buy songs in iTune. How can I do this?
Hello, I'm interested to buy songs from itune, specifically I want to buy ringtones but because of my location I am restricted. I live in Albania, which apparentely is not allowd to buy songs from this application. Please let me know if there is any