Hello all,
We are doing some tests involving some mailmerge directly to a word document.
When merging we append a waterwark to the document before we save, and this works very well.
However when saving to PDF or XPS - the watermark from the document, is not in the file.
Hi
Thanks for your request. Could you please attach your input and output documents here for testing? I will investigate the issue and provide you more information.
Best regards,
Please see attached
input_doc.docx - > template for merge
merge_result.docx -> resulting word fil, merged with background watermark
pdf_out.pdf -> same result, but no background.
Hello
Thanks you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words (9.7.0) and the following code:
Document doc = new Document("C:\\Temp\\merge_result.docx");
doc.Save("C:\\Temp\\out.pdf", SaveFormat.Pdf);
It seems you are using Aspose.Words in evaluation mode. In this case Aspose.Words adds evaluation watermark at the top of your document. Please request a 30-day Temporary License to test Aspose.Words without evaluation limitations as described here
https://purchase.aspose.com/temporary-license
And please apply license as described here:
https://docs.aspose.com/words/net/licensing/
Could you please try using Aspose.Words without evaluation limitations and let me know how it goes on your side.
Best regards,
Hi,
Yes have tried it with a temp licens - and still the same.
Your eksample, works here also.
Document doc = new Document("C:\\Temp\\merge_result.docx");
doc.Save("C:\\Temp\\out.pdf", SaveFormat.Pdf);
But it fails when you try something like this.
Mailmerge logic…
document.Save(_finaldestination,Aspose.Words.SaveFormat.Docx);
document.Save(@"C:\test_pdf.pdf", Aspose.Words.SaveFormat.Pdf );
it ocours when the document is still in the memory, ie not saved to disk.
i have to re-open the document and then save it to PDF, behaps just a minor issue - but still.
Hi
Thank you for additional information. I still cannot reproduce the problem. Could you please create simple application, which will demonstrate the problem on my side? I will investigate the issue and provide you more information.
Best regards,
Hello Andrey,
Yes sure - i have changed one off your own samples . this should show the problem.
Hello,
Thank you for additional information.
I reproduced the problem on my side.
Please try to call Document.UpdatePageLayout() just before saving documents.
Here’s how:
Document doc = new Document(Path.Combine(exeDir , "Template.doc"));
InsertWatermarkText(doc);
doc.UpdatePageLayout();
doc.Save(Path.Combine(exeDir, "TestFile.docx"),SaveFormat.Docx ); //-> ok with watermark
doc.Save(Path.Combine(exeDir, "TestFile.pdf"),SaveFormat.Pdf); // now it is OK.
Hi,
Yes that did it , Thank you