Text decoding in clipboard - c#

the task arose to copy text from the editor or telegram to photoshop or premiere while maintaining the formatting. When copying text between Adobe products, the formatting is preserved, but not when copying from other editors. When encoding text from adobe products, 2 MemoryStream and 3 text options in different formats appear on the clipboard. Having translated their contents into text, it appears that what needs to be changed in the MemoryStream so that any text can be transferred while maintaining formatting from any editor?
stream
I converted the memory stream to text and thought to replace the parts responsible for formatting bold text, but I did not find the elements responsible for this

Related

iTextSharp: Use text and image as a SINGLE annotation

I have a piece of code that stamps a PDF by merging a FormXObject of a source pdf file. What I am trying to do is superimpose some text into that. How does one approach such operation?
Add an image or merge a PDF to an existing document.
Add a text relative to that image/pdf.
Concatenate the text and image into one selectable annotation (ideally a stamp)
I can do step one individually, but superimposing the text is what remains unclear. Think of it as trying to fake a signature using a stamp that contains modifiable text (similar to Adobe's Signature Appearance).

Extracting text from a PDF and getting the coordinates of an embedded image

I need to extract text from a pdf document and I am using the iTextSharp library to do so. The issue is that the image has text on it which is not part of the image. I have been looking to find a way to get the coordinates of the image as there are annotations on the image being included in the text extraction:
e.g.
Results in the extraction:
Some text...
Text
Text
More Text..
However, the text in the image is irrelevant and needs to be ignored to give the output:
Some text...
More text...
Another issue is that there are multiple pages with this issue with images all being different sizes, however, all the text is always within the image bounds which is why if I have a way of determining the height and x, y coordinates of the image relative to the page I can extract the necessary data.
Currently, I need to just get the text but I will also need to extract the images at a later date.

How to recognise characters of particular icon's text in TIFF image file

While recognizing the characters in a TIFF image,able to read the characters by using OCR method,MODI but where as while reading specific text format, it doesn't read the exact characters and shows some unknown characters.
Suppose this is the text format in an TIFF image file, how can I read the characters clearly in the below image?
Any way to recognize and display exact characters again?
Image analysis and OCR is always kind of a soft science, since it might work on one instance and fail in another.
Can you apply some filters before performing the OCR? You might try to blur the image beforehand to soften the impact of the dotted background and then perform OCR on the image.

How To Read an .rtf via a StreamReader Ignoring the .rtf file formatting ? (Not Maintaining it)

I have a StreamReader reading from a .txt, .rtf and .docx files.
I store what is read in a string variable, then I print this variable to a RichTextBox
the problem is that my RichTextBox BackColor is Black and the ForeColor is Green,
so if the text color in the .rtf file is black, it won't be visible in the TextBox,
not to mention that it won't use the Font that I specified in my TextBox !
Maybe I could just use a normal TextBox, not a RichTextBox, but that way I won't be able to Color the text in the TextBox...
How Can I fix That ?
One possibility would be to have a second, invisible, RichTextBox on the form. Read the RTF from the StreamReader, store it in the hidden text box, then read the text from the hidden text box and write it to the visible one. Something like:
string rtfText = File.ReadAllText(filename);
hiddenTextBox.Rtf = rtfText;
visibleTextBox.Text = hiddenTextBox.Text;
Not exactly elegant, but it handles the nasty work of stripping the formatting for you.

iTextSharp - Copying elements from one PDF to another

I want to copy certain elements from one PDF to another using iTextSharp.
I want to read one PDF, read text elements from that and correct them and create a new PDF using the updated text elements and all the images etc. from the first PDF.
Please help me how this can be achieved.
This task is very complex. I wrote a program to do this for a large greeting card maker.
First you have to locate the text and calculate the glyph bounding boxes. Next you have to modify the contents stream to remove the text. The text may be broken into many pieces depending on the PDF creator. You have to remove those operators from the contents stream and adjust the CTM because some operators use relative positioning. Finally, you have to insert the replacement text, matching the original text's style (font, size, color, orientation, etc.)
As for copying elements from one PDF to another, most of the steps above are required plus you have to copy resources, eg. fonts, colorspaces, patterns, etc, to the new PDF.

Categories

Resources