Is there a way to add watermark invoice into PDF file?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Hi Team,
I have a requirement to add watermark invoice into PDF when customer make a purchase of soft copy. Is there any plug in?
Appreciate any advice! Thanks...
8 years ago
Hi,

Yes we can add watermark to exported PDF, It will require small code changes.

NopCommerce is using iTextSharp for generating PDF files. You can refer to iTextSharp's documentation for adding watermark in exporting pdf.

For testing purpose, I've updated code in NopCommerce 3.70.

..\Libraries\Nop.Services\Common\PdfService.cs

Method Name:
public virtual void PrintOrdersToPdf(Stream stream, IList<Order> orders, int languageId = 0)

Added new line in code.
string watermarkText = "NopCommerce PDF Watermark";
                ColumnText.ShowTextAligned(pdfWriter.DirectContent, Element.ALIGN_CENTER, new Phrase(watermarkText, font), 300, 400, 45);




Exported PDF Invoice of test order.





Hope this helps.

Thanks,
Ajay
8 years ago
Hi Ajay,
Thanks for your advice. Actually, what we need is not to create a new pdf with watermark.
We already have PDF, so called e-book. Once user made a payment for e-book, we would like to add invoice number watermark on the existing e-book PDFs. Hope to get some advice from you. Thanks.

Regards,
Han
8 years ago
Actually this is not possible in core code.
I give some links which helps you to reach your goal.
http://www.donnfelker.com/using-itextsharp-to-watermarkwrite-text-to-existing-pdfs/
http://stackoverflow.com/questions/17522965/how-to-add-a-watermark-to-a-pdf-file
http://stackoverflow.com/questions/18253707/itextsharp-modify-existing-pdf-no-new-source-pdf-and-add-watermark
8 years ago
Hi Anik1991,

Thanks for your information. Do you know is there any paid plugin to success this topic? :)
8 years ago
You can search, but so far i know there is no plugin available for your issue.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.