How to add logo to Packaging Slip pdf in Nop Commerce 1.90 site?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 9 ans
Hello Forum,

I am new to nop site and we have made nop commerce 1.90 site for our client in 2011. But now client wants logo on print packaging PDF. I don't know how to add logo to that PDF. In invoice it is easy to add logo.

Please help me. I really need help.

Thank you in advance
Il y a 9 ans
Nopcommerce do not have that support now, you can modify the source if you like to do so.

Find Nop.Services->Common -> PdfService.cs
Here is the code how logo works on invoice, you need to duplicate same thing in PrintPackagingSlipsToPdf method

public virtual void PrintOrdersToPdf(Stream stream, IList<Order> orders, int languageId = 0)
{
...
#region Header

                //logo
                var logoPicture = _pictureService.GetPictureById(_pdfSettings.LogoPictureId);
                var logoExists = logoPicture != null;

                //header
                var headerTable = new PdfPTable(logoExists ? 2 : 1);
                headerTable.WidthPercentage = 100f;
                if (logoExists)
                    headerTable.SetWidths(new[] { 50, 50 });

                //logo
                if (logoExists)
                {
                    var logoFilePath = _pictureService.GetThumbLocalPath(logoPicture, 0, false);
                    var cellLogo = new PdfPCell(Image.GetInstance(logoFilePath));
                    cellLogo.Border = Rectangle.NO_BORDER;
                    headerTable.AddCell(cellLogo);
                }
                //store info
                var cell = new PdfPCell();
                cell.Border = Rectangle.NO_BORDER;
                cell.AddElement(new Paragraph(String.Format(_localizationService.GetResource("PDFInvoice.Order#", lang.Id), order.Id), titleFont));
                var store = _storeService.GetStoreById(order.StoreId) ?? _storeContext.CurrentStore;
                var anchor = new Anchor(store.Url.Trim(new char[] { '/' }), font);
                anchor.Reference = store.Url;
                cell.AddElement(new Paragraph(anchor));
                cell.AddElement(new Paragraph(String.Format(_localizationService.GetResource("PDFInvoice.OrderDate", lang.Id), _dateTimeHelper.ConvertToUserTime(order.CreatedOnUtc, DateTimeKind.Utc).ToString("D", new CultureInfo(lang.LanguageCulture))), font));
                headerTable.AddCell(cell);
                doc.Add(headerTable);

                #endregion
....
}
Il y a 9 ans
rsuthar wrote:
Hello Forum,

I am new to nop site and we have made nop commerce 1.90 site for our client in 2011. But now client wants logo on print packaging PDF. I don't know how to add logo to that PDF. In invoice it is easy to add logo.

Please help me. I really need help.

Thank you in advance

In admin>configuration>global settings>media tab you can upload the logo for PDF invoices
Il y a 9 ans
Thank you shahdat45ict for coding I will try that. and thank you eadameg for that path. I already uploaded logo there.

Thank you very much both for your reply.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.