Change the width of Order pdf in nopcommerce 4.5.4

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 ano atrás
Hi,


How to change the width of columns in Order PDF from PdfService.cs.

For eg. I want to change the width of first and second column of from PdfService.cs

Kindly help me for the same.

Regards,
Diksha Jagtap
1 ano atrás
Hi,


For more details of code please check below

var productsTable = new PdfPTable(_catalogSettings.ShowProductSku ? 3 : 2);
                productsTable.RunDirection = GetDirection(lang);
                productsTable.WidthPercentage = 100f;
                if (lang.Rtl)
                {
                    productsTable.SetWidths(_catalogSettings.ShowProductSku
                        ? new[] { 25, 25, 50 }
                        : new[] { 25, 75 });
                }
                else
                {
                    productsTable.SetWidths(_catalogSettings.ShowProductSku
                        ? new[] { 50, 25, 25 }
                        : new[] { 75, 25});
                }


Regards,
Diksha Jagtap
1 ano atrás
Your code looks similar to what's already in the code - example:
var notesTable = new PdfPTable(2)
{
    RunDirection = GetDirection(lang),
    WidthPercentage = 100f
};
notesTable.SetWidths(lang.Rtl ? new[] { 70, 30 } : new[] { 30, 70 });

So, what is the problem?
1 ano atrás
Hi,

How can I change the width of first column and second column.

How do I do it

Regards,
Diksha Jagtap
1 ano atrás
Note that the widths are specified in the 'array' :
  new[] { 25, 25, 50 }

Each number is a percentage.  You can see that they all add up to 100:  25 + 25 + 50
So, if you change the #'s, be sure the total is 100.  E.g.
  new[] { 30, 30, 40 }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.