how to format PDF Invoice ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 yıl önce
Thank you Ben, I believe that you offer the solution for not just Admin pdf invoice printing, but users' pdf as well.  I will try your codes to see and learn more.
What I have trouble right now is the Company Name in Admin pdf invoice printing.
There is something relates to getlocaleresourcestring that can not result to billingcompany or shippingcompany.
The pdf invoice give me "pdfinvoice.company" instead of replace it with "Company" name.
Is there any thing that I should change to fix it?
Thanks
14 yıl önce
anthny wrote:
The pdf invoice give me "pdfinvoice.company" instead of replace it with "Company" name.
Is there any thing that I should change to fix it?
Thanks


This would normally indicate that the resource string PDFInvoice.Company does not exist. can you verify that it does.

Will have a look at the code tonight and confirm the exact line of code that should output the company name.

Regards
Ben
14 yıl önce
Thanks, Ben. The log indicates that resource string can not be found, just like you point out.  Where can I locate and veryfy it.  I only see it in pdfhelp.
14 yıl önce
Admin > Content Management > Localization
14 yıl önce
Thanks Holliday.  My issues is solved.  It sounds so simple to you, bt for me it is not.
Very appreciated. Tony
14 yıl önce
Ben, Holliday helped me out and I can get the name now. The image I can only pull it out to pdf using the way Holliday showed me.
I can not use:
doc.Add(Image.GetInstance(Server.MapPath("~/content/images/logo.jpg")));

How can I get the "Server" instance? hope I use the right term.
I also can not get "_templateService" instance.

Hope you don't mind explain it to me or show me how to.
Thanks
14 yıl önce
anthny wrote:
Ben, Holliday helped me out and I can get the name now. The image I can only pull it out to pdf using the way Holliday showed me.
I can not use:
doc.Add(Image.GetInstance(Server.MapPath("~/content/images/logo.jpg")));

How can I get the "Server" instance? hope I use the right term.
I also can not get "_templateService" instance.


Hi Anthony,

As per my post, that code was for another application. The template service doesn't exist in nopCommerce.

Most of the code in the PDFHelper class involves building up the table. My template service along with the HTMLWorker does this work in the example.

However, the end result is that you add these elements to the document:


doc.Add(addressTable);


Regarding the image:

a) make sure that the image exists (you don't have to use the path I posted)
b) You will probably need to use HttpContext.Current.Server.MapPath(path to your image) since you are not executing this code within a Page (my example was actually inside an MVC controller action but same difference).

Hope this helps
Ben
14 yıl önce
Ben, Sure it helps. I see why I can not get server instance now.
Very appreciate your and Holliday's help.
Tony
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.