We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image missing lines after conversion from Word to PDF

We have noticed a few instances where an image has lost some content after conversion from Word to PDF. In this case there are dashed lines missing joing the dots on the graph. Is there a way to fix this?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

As a workaround, please try using the following code:

// Open source document.

Document doc = new Document(@"Test001\Image+Issue+2.doc");

// Get all shapes in the document.

NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);

// Loop through all shapes.

foreach (Shape shape in shapes)

{

// If shape contains a vector image, convert it to raster image.

if (shape.HasImage && (shape.ImageData.ImageType == ImageType.Wmf || shape.ImageData.ImageType == ImageType.Emf))

{

using (MemoryStream vectorImageStream = new MemoryStream(shape.ImageData.ImageBytes))

using (Image image = Image.FromStream(vectorImageStream))

using (MemoryStream resterImageStream = new MemoryStream())

{

image.Save(resterImageStream, ImageFormat.Png);

shape.ImageData.SetImage(resterImageStream);

}

}

}

// Save output docuemnt to PDF.

doc.Save(@"Test001\out.pdf");

Hope this helps.

Best regards,

Getting compilation error: Image.FromStream and ImageFormat not defined.

Where is this class defined? Couldn't find it in documentation as well.

Thanks

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Please add the following:

using System.Drawing;

using System.Drawing.Imaging;

Best regards,

Thanks for the workaround. It looks better now. However, after doing as described, quality of images got slightly decreased. Is there any way of keeping their picture quality?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Your image is in vector format that’s why it has good quality but after converting to raster format the quality is reduced. This is expected.

Best regards,

Thanks for the reply. Is it possible to just narrow this code down to Word Drawing Canvas objects, as that is predominantly where the issue exists. There are many other regular pictures objects (like equations) in the document which are rendering perfectly as vector images so we would not want to convert them to raster images because there is a siginificant loss of quality.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. This is the only option to work the problem around I can suggest you in the moment. If quality of images is so important for you, you should wait the fix of the original issue.

Best regards,

The issues you have found earlier (filed as 11521) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.