Hello.
I want a way that simulate the CopyAsPicture() Method that is available in Microsoft Word Automation in Aspose.words
Thank you…
Hello.
I want a way that simulate the CopyAsPicture() Method that is available in Microsoft Word Automation in Aspose.words
Thank you…
Can anyone help me?!
Hi,
Thanks for your inquiry and sorry for the delayed response. The CopyAsPicture method works the same way as the Copy method. On the other hand, a picture is represented by either Shape or DrawingML node in Aspose.Words’ DOM (Document Object Modal). There are different ways you can copy this node; for example, you can use Shape.Clone method to be able to duplicate this node.
Please let me know if I can be of any further assistance.
Best Regards,
Thank you awais.
But…
I want to show an image of a document or a paragraph in an Image control,
but with save as Jpeg options in aspose.words, unicode data are not supported.
In automation, I use CopyAsPicture() and then the image of document or paragraph set to the clipboard, and I use this data and then show the image.
I want to set the clipboard data with an image of document or a paragraph.
Can you send me a sample code that copies a document as image or shape in Aspose?
Hi,
Thanks for the additional information. Sure, you can copy an image in document to Clipboard by using the following code snippet:
Document doc = new Document(@"C:\test\Shape.doc");
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
Shape logo = shapes[0] as Shape;
Clipboard.SetImage(logo.ImageData.ToImage());
Best Regards,
Thank you for your attention awais.
Sorry, I do not mean just the copy only the images in the paragraphs!
I want to copy all texts and images and other things in the paragraph as image!
Such that the paragraph be photographed.
Hi,
Thanks for the additional information. I think, you can achieve this by using the following code snippet:
Document doc = new Document(@"C:\test\Sample.doc");
Node node = doc.FirstSection.Body.FirstParagraph;
Document dstDoc = new Document();
dstDoc.FirstSection.Body.RemoveAllChildren();
NodeImporter importer = new NodeImporter(doc, dstDoc, ImportFormatMode.KeepSourceFormatting);
Node importNode = importer.ImportNode(node, true);
dstDoc.FirstSection.Body.AppendChild(importNode);
dstDoc.Save(@"C:\test\out.png");
Best Regards,
hi ,
thank you for your attention again
we use unicode text in document and in aspose.words version 10 when we use
dstDoc.Save(@"C:\test\out.png");
then result picture Be cluttered, i think it has a problem with right to left language.
original document : Original.doc
result picture : Result.png
Hi,
Thanks for your inquiry.
While using the latest version of Aspose.Words i.e. 11.5.0, I was unable to reproduce this issue on my side. Moreover, I have attached the PNG file, i.e. generated on my side, here for your reference. Also, I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link:
https://downloads.aspose.com/words/net
I hope, this will help.
Best Regards,