Get Images count and positions from Rtf using C# - c#

I have some RTF text. Sometimes text contain some images. Images is displayed inside any rtf editor, but i cannot get images positions programmatically.
I have used RichTextBox control for RTF parsing, but is unable to detect image positions inside text in RichTextBox control
So, does anybody know how to parse RTF and get images positions inside text programmatically using C#?

You might take a look at http://www.codeproject.com/KB/string/nrtftree.aspx it is open source and able to extract images, so I hope this helps.

Related

Read word file content (image and text) with formatting information

I want to convert the complex word document (which includes both text and images) into RTF text preserving formatting information. Sample image of document content is as shown below
How I can read this information as RTF text so that I can perfectly preserve the formatting and image location information. I tried to read word file using RichTextbox's LoadFile function but it doesn't preserve the formatting & image location information.
Looking forward to receive some suggestions to maintain the formatting and image location information.
Thanks
You could simply save the document in the RTF format...

How to convert Text containing Images into pdf using iText#

I have a richtextbox and by far, i have been successful in converting plain text into pdf using iTextsharp. Now, the situation is, when i copy some text from any source let's say a website and along text, it contains images. Now when i try to convert the content (text + images) into pdf, resulting pdf doesn't show images. I know that there would be some property to be set for the richtextbox or using itextsharp so to have images as well. I also know that we can insert images by giving path to that image but this is not what i want. I want to have plain text along with images while direct conversion from richtextbox to pdf. Forexample i have,![Im resulting pdf i want the same as in richtextbox][1]: http://i.stack.imgur.com/ts0ec.jpg
How can i have the same as in richtextbox? How can i specify orientation for text and image to be justified?

Print coordinates in VB.NET or C#

I have to print invoices from my software. I created the layout with Adobe Illustrator and saved it as a PNG image. My original idea was printing the layout as a background and then print the actual data taken from the database. I printed my layout inside my function and then I measured the various boxes of the layout for correctly placing my text. The problem is that my text is not printed in the correct position that I've found. I tried to change the margins to 0 but it seems to have no effect. I want this: if I choose to print my text line at x=10 mm and y=20mm the text must be phisically printed in this position without scaling/translating, also my background image.
Can you help me?
Try using (e.g.) e.Graphics.PageUnit = GraphicsUnit.Milimeter, and then simply specify the desired values using the Graphics.DrawString Method

image inline in RichTextBox in windows forms

I read rtf file from system. and load to richtextbox.
richTextBox1.LoadFile(#"C:\Users\cpsinghal\Desktop\newt.rtf", RichTextBoxStreamType.RichText);
In this rtf has image also. but richtextbox is not display image properly. image inline is bed.
I found image tag in richtextbox.rtf is {\pict\wmetafil.........}
and i add {\dn20{\pict\wmetafil.........}} and save as .rtf in system. then image is inline.
but richtextbox is not showing image inline.
is any other option or can i extend richtextbox.
please guide me.

Replace text in PDF

I'm trying to replace a section of a PDF with different text. From research on all major PDF libraries for .NET, it seems this is complicated and not a trivial task. I think it may be easier to convert the PDF to an image, replace the text (always in the same place), then convert it back to a PDF (or leave it as an image if converting back isn't possible). Is it possible to extract an image from a PDF page with .NET?
If your text is in a known location, you can simply cover it with a rectangle filled with the background color, and then draw your text over top.
Note that the text will still be there, it simply won't be visible. Someone selecting text will still pick up the old stuff. If that's acceptable, it's quite trivial.
If the PDF was created from image, you can import it into Photoshop to edit it as an graphic. Or you can use screenshot program like "Snagit" to capture pdf page as image and use snagit's editor to erase old text and replace new one.
But this method may bring you problem is that the new added text may not the same font as text around it. Personally, I use pdf editor to replace text in pdf since the added text will be automatically fit with the original font and size.

Categories