The way the "offers" PDF works is that we generate it by using a JavaScript PDF generation library named PDFMAKE : http://pdfmake.org/
To change the design or layout or downloaded PDFs, you'd need to make changes to the JS parameters used when generating it.
For example you can see some options at http://pdfmake.org/playground.html for tables, alignments, images, styling, although there are no specific predefined layouts.
In the public side, it's generated in the public.js file, in the function
I'm trying to customise the pdf file generated when the offer was created but it's not that easy... I would like to change (translate) the texts inside the pdf:
I suggest you try to go to Loco Translate -> Plugins -> B2BKing -> your language -> and then click SYNC.
Then try to search for the texts in the PDF and see if you can find them then.
If that doesn't work, I'm not sure why. I can try to check the issue directly if you'd like to share a backend login to your site or staging site. Please also let me know if you are downloading the PDF in the site backend, or in the frontend.
Hi,
I was wondering if there is a template that I can edit to change the "Offers" PDF that can be downloaded from B2B king?
Thanks,
Cameron McAdam
Bright Light Marketing
Hi Cameron,
The way the "offers" PDF works is that we generate it by using a JavaScript PDF generation library named PDFMAKE : http://pdfmake.org/
To change the design or layout or downloaded PDFs, you'd need to make changes to the JS parameters used when generating it.
For example you can see some options at http://pdfmake.org/playground.html for tables, alignments, images, styling, although there are no specific predefined layouts.
In the public side, it's generated in the public.js file, in the function
$('.b2bking_offer_download').on('click',function(){
Basically, to make changes to the PDF, you'd need to make changes here in this function.
Hope that helps, but let me know if you have any questions or anything I can help with,
Kind regards,
Stefan
Thanks Stefan,
I assume I'll need to copy that file into my child theme folder? is there a particular folder in there I need to create for it?
Kind Regards,
Cameron
I don't think it works to copy that to the theme folder since it's a JS file.
However, we can remove the event listener for the click event from the download buttons, and add the (your modified) function again.
You would add the following JS to your site:
All I did there is that I added
to remove the existing function, and then I copy pasted the function to add it again.
You can add this as a JS snippet per our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/
Hope that makes sense, but let me know if I can assist,
Thanks for that, Once I find out what changes my client wants I'll jump in and see how I go.
Hi,
I'm trying to customise the pdf file generated when the offer was created but it's not that easy...
I would like to change (translate) the texts inside the pdf:
can you help me ?
Thanks
Hi there,
The texts should be fully translatable via Loco Translate. If you're not familiar with that, I'd recommend you follow our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-translate-b2bking-to-any-language-localization/
Or is there any specific text you're having issues with?
Kind regards,
Stefan
Hi
I have already translated many of the B2Bking texts with locotranslate: it works well on the website.
However, when generating the pdf file of the offers, the texts are not translated.
Do you have any idea what the problem is?
Thank uou
I suggest you try to go to Loco Translate -> Plugins -> B2BKing -> your language -> and then click SYNC.
Then try to search for the texts in the PDF and see if you can find them then.
If that doesn't work, I'm not sure why. I can try to check the issue directly if you'd like to share a backend login to your site or staging site. Please also let me know if you are downloading the PDF in the site backend, or in the frontend.
Ok thank you
After sync and modify translation it's ok !
Glad that worked, thanks for the update!