Merge of pdf files does not keep formatting

Hello !

I’m trying to merge two pdf files using Aspose.Words.Document and the AppendDocument method.
I’m using the example from this page Merge Word, PDF And Many Other File Formats Using C#, but the file formatting is loss.

Can you help me ?

This is the document I’m using for tests: DocumentPdf1.pdf (32.5 KB)

And this is the result document: merged.pdf (15.6 KB)

@bucherbCould you kindly provide more information about the specific format that appears to be missing? Upon inspecting both PDFs, I have observed that the text properties remain consistent and unchanged.

Hello @eduardo.canal, when I open the PDF it shows :
image.png (4.7 KB)
on the first page and
image.png (6.4 KB)
on the second page…

Since both pages are from the same document (I am merging the same document) they should display the same, right ?

@bucherb

Thank you for providing the additional information. I have thoroughly understood the issue at hand and have successfully replicated it.

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-25504

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.

@bucherb I have closed the defect as not a bug. When you open PDF document using Aspose.Words it is loaded into flow Aspose.Words Document Object Model. Dues to the Fixed Page nature of PDF document, such model conversion might lead to lose of fidelity.
If your goal is to merge PDF documents keeping their original formatting, you can use a brend new LowCode.Merger feature of Aspose.Words:

Aspose.Words.LowCode.Merger.Merge(@"C:\Temp\out.pdf", new string[] { @"C:\Temp\DocumentPdf1.pdf", @"C:\Temp\DocumentPdf1.pdf" });

In this case PDF documents are merged without converting them to flow document object model and formatting is preserved: out.pdf (15.3 KB)

2 Likes

Hi @alexey.noskov, thank you for your response.

My licence expired on 22.12 and I have no access to this class.
Can you tell me what version this new feature is available in?

@bucherb The feature is available starting the 23.6 version of Aspose.Words.

1 Like

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