How to write memory stream to PDF File of invoice

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
I have made a plugin, i want custom invoice pdf for which i overridden Nop.Services.Common.IPdfService method

My method  :

public void PrintOrdersToPdf(Stream stream, IList<Order> orders, int languageId = 0, int vendorId = 0)
        {            
             ...
             ...
             ...
             var templatePath = Path.Combine("Sample.pdf");
             var reader = new PdfReader(templatePath);
             var stamper = new PdfStamper(reader, stream);

        }
Everything works without error, stream gets loaded with lenth,capacity.

But after invoice gets downloaded , it does not open
Error : Failed to open PDF document.

Please suggest what to do.
5 years ago
Does it work if you use File Explorer and go to your Downloads folder and open it from there?  (If so, then it's a probably a browser setting)
5 years ago
No, it's not opening from downloads folder.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.