Hello,
I’m having trouble when appending a PDF to an Aspose.Words (.NET v23.4.0.0) document and then saving the whole thing as a PDF. The resulting PDF output leaves the appended PDF at a significant loss of PDF quality. It’s very pixelated and fuzzy.
When I use your tool here to attempt the merge, the output is the same as my code (poor), but when I use this tool to do the same thing, it works as expected and produces a nice, high resolution output.
My question is what is the difference between your 2 online tools and what do I need to do differently to preserve the output quality of my PDF?
@kgrems Please note, Aspose.Words is designed to work with MS Word documents. MS Word documents are flow documents and they have structure very similar to Aspose.Words Document Object Model. On the other hand PDF documents are fixed page format documents . While loading PDF document using such code, Aspose.Words converts Fixed Page Document structure into the Flow Document Object Model. Then, in your scenario the flow DOM is converted back to fixed-page - PDF. Unfortunately, such conversion does not guaranty 100% fidelity.
You can use Aspose.PDF to merge PDF documents to get accurate result: https://docs.aspose.com/pdf/net/merge-pdf-documents/
@alexey.noskov
Thank you for the reply. My question now is how does this code do it? As you can see in the URL, it’s using the Words API and does exactly what I need it to. My question is how can I do the same thing in my code?
Kevin
@kgrems You can try merging PDF documents without loading them into the Aspose.Words DOM. Please see the following code:
Aspose.Words.Pdf2Word.FixedFormats.PdfFixedRenderer pdfFixedRenderer = new Aspose.Words.Pdf2Word.FixedFormats.PdfFixedRenderer();
using (FileStream pdf1 = File.OpenRead(@"C:\Temp\1.pdf"))
using (FileStream pdf2 = File.OpenRead(@"C:\Temp\2.pdf"))
{
using (Stream resultStream = pdfFixedRenderer.MergePdf(pdf1, pdf2))
using (FileStream resultFile = File.Create(@"C:\Temp\out.pdf"))
resultStream.CopyTo(resultFile);
}
But as I can see In this case format is also damaged.
As I can see the App uses Aspose.PDF for merging PDF documents.
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-25383
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.
@alexey.noskov
Using the code you provided does indeed maintain the high resolution of the resulting PDF, so thank you for that. As you mentioned, unfortunately the resulting PDF is definitely full of problems.
If the online App I mentioned above actually uses Aspose.PDF for merging those documents online, I would highly recommend changing the URL to reflect this. That online app was partly what we used to determine if Aspose.Words would meet our needs or not.
I can appreciate your offer of paid support services, however if the issues are bugs in your libraries, I don’t feel that this will be necessary.
We will be waiting for your fix to this merging code.
@kgrems Yes, I get the same output PDF document on my side. We will keep you updated and let you know once the issue is resolved. Also we will update the words apps so that they use only Aspose.Words features.
@kgrems The issue is currently in development. If everything goes smoothly the fix will be available in 23.7 version of Aspose.Words. We will keep you informed and let you know once the issue is resolved.
@alexey.noskov One issue has been fixed. The combined PDF no longer has the strange lines, but the quality of the second PDF in the combined document is significantly degraded.
@kgrems
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-25497
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.
By the way in 23.6 version we have introduced LowCode concept in Aspose.Words. You can now use the following code to merge PDF or other documents with only one line of code:
Aspose.Words.LowCode.Merger.Merge(@"C:\Temp\out.pdf", new string[] { @"C:\Temp\FloorPlanMerge1.pdf", @"C:\Temp\FloorPlanMerge2.pdf" });
@kgrems The issue is already resolved in the current codebase. The fix will be included into the next 23.7 version of Aspose.Words. We will be sure to let you know once it is released.