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

Free Support Forum - aspose.com

Slow creation of pdf document In case of image type "emz" inside xml document

Hi Team,

I am creating a pdf document from the xml document having “emz” as image type in it.
Below code took 30-40 seconds to create the pdf document. If i remove the image or insert it as a “png” then the document created within 1-2 seconds.

Dim doc As New Aspose.Words.Document(ms)
doc.Save(pdfDocumentName)
StopWatch.Stop()

Please let me know if we can improve the pdf creation.

@nadeem373

Please ZIP and attach your input Word document here for testing. We will investigate the issue and provide you more information on it.

Thank you for the reply.Call Invoice v3.zip (166.6 KB)

Please find the attached zip file for further investigation.

@nadeem373

We have tested the scenario and managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-22463. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,

Thank you for the reply. Can we use ASPOSE.NET to convert emz bindata inside the XML file to png data ?

@nadeem373

Please use following code example to convert EMZ to PNG in the document. Hope this helps you.

var document = new Document(MyDir + @"Call Invoice v3.xml");
DocumentBuilder builder = new DocumentBuilder(document);
foreach (Shape shape in document.GetChildNodes(NodeType.Shape, true))
{
    if (shape.HasImage)
    {
        MemoryStream stream = new MemoryStream();
        shape.GetShapeRenderer().Save(stream, new ImageSaveOptions(SaveFormat.Png));
        shape.ImageData.SetImage(stream);
    }
}
                
document.Save(MyDir + "21.7.xml", SaveFormat.WordML);

The issues you have found earlier (filed as WORDSNET-22463) have been fixed in this Aspose.Words for .NET 21.9 update.