Aspose.Words 2023-10 Export-Error to PDF

Hello, I’ve updated our project to Aspose.Words 2023-10. Now I’m getting strange additional columns in the export to pdf. The export to word is working well. Can you help me to find the problem?

23_03.pdf (35.1 KB)

23_10.pdf (32.5 KB)

@sprengnetter.avm Could you please attach your source document here for testing or provide simple console application that will allow us to reproduce the problem? We will check the issue and provide you more information.

Hello, here is the template file:

template.docx (34.2 KB)

thanks :slight_smile:

@sprengnetter.avm Thank you for additional information. Unfortunately, I cannot reproduce the problem on my side. Here is PDF produced by the following simple code:
out.pdf (38.6 KB)

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.pdf");

Could you please provide a simple code that will allow us to reproduce the problem on our side? As I can see your PDF documents are postprocessed by iLovePDF tool. Does the document look damaged before processing PDF using this tool?

Hello, thanks for the quick reply. I only used iLovePDF for a quick split of one of the damaged pages … Our workflow is that we replace a text-makro with the content of template.docx in a root document. The root document is then exported to pdf and docx. The version with pdf-export is broken.

We have in the root document a makro eg “template_makro” and replace this with the content of template.docx.

The code we use:

public void InsertAfterParagraph(ReplacingArgs args, byte[] data)
{
    var node = (Node)args.MatchNode.ParentNode;
    using Stream stream = StreamManager.Instance.GetStream(data);
    stream.Position = 0;

    var srcDoc = new Document(stream);
    var dstDoc = node.ParentNode;
    if (dstDoc == null)
    {
        return;
    }

    var importer = new NodeImporter(srcDoc, node.Document, ImportFormatMode.UseDestinationStyles);

    foreach (var srcSection in srcDoc.Sections.OfType<Section>())
    {
        foreach (var srcNode in srcSection.Body)
        {
            if (srcNode.NodeType.Equals(NodeType.Paragraph))
            {
                var paragraph = (Paragraph)srcNode;

                if (paragraph.IsEndOfSection && !paragraph.HasChildNodes)
                {
                    continue;
                }
            }

            var newNode = importer.ImportNode(srcNode, true);
            dstDoc.InsertAfter(newNode, node);
            node = newNode;
        }
    }
}

The code for exporting our pdf is:

// Save options
var options = new PdfSaveOptions
{
    UseHighQualityRendering = true,
    UseAntiAliasing = true
};
// Save
document.Save(stream, options);

This mechanism is working now for years, but with this update it seems to be broken. Something in the PDF-Settings maybe changed a little bit?

@sprengnetter.avm If possible could you please create a simple console application including all required documents that will allow us to reproduce the problem? Unfortunately, I cannot reproduce the problem on my side using the provided resources.

Hi, after intensive research I can localize the problem … the problem is caused by inheritation … but I still have no idea why … we are using:

public class RenderDocument : Document
{
    public RenderDocument(Stream stream) : base(stream)
    {
    }...    
}

aspose-sample.zip (83.1 KB)

@sprengnetter.avm
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-26105

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as WORDSNET-26105) have been fixed in this Aspose.Words for .NET 23.11 update also available on NuGet.