Free Support Forum - aspose.com

Problem in including the VISIO objects in to PDF using Aspose.Words

Hi

We are extracting the Images from Input.doc and generating the PDF with extracted Images using Template.doc (Aspose.Words).

The Output is a PDF which is as attached in Output.pdf., The image in the PDF contains a black border which is not expected in the output.

The image in the Input.doc is a VISIO object and there is a slight gap in between one row of the Grid lines in VISIO (This line is not easily visible in VISIO, Zoom the visio to larger number say 200).

The white line in VISIO is resulting in a black border when converted in to PDF.

We are unable to get rid of this black border around the Image in PDF. We have also tried to modify the VISIO object but of no use. Please let us know how to get rid of this border.

Are we missing any property to be set programatically?

We are using Document Builder's InsertImage() method to insert the images in to PDF

Note: Editing of the Extracted Images need to be done programatically

Thanks in advance.

Hi

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

Thanks for your inquiry. I cannot reproduce the problem on my side using the latest version of Aspose.Words (7.0.0). I use the following code for testing:

// Open input document.

Document src = new Document(@"Test001\Input.doc");

// Open template and create DocumentBuilder.

Document dst = new Document(@"Test001\Template.doc");

DocumentBuilder builder = new DocumentBuilder(dst);

// Get Image from the source document.

Shape shape = (Shape)src.GetChild(NodeType.Shape, 0, true);

// Get image bytes.

byte[] imgBytes = shape.ImageData.ImageBytes;

// Insert shape into the template document.

builder.MoveToBookmark("WBM_IMAGE");

builder.InsertImage(imgBytes);

// Save docuemnt to PDF.

dst.SaveToPdf(@"Test001\out.pdf");

Best regards,

Hi Andrey,

Now its working for me with your code.

Great job!! Thanks for your quick reply.