Pdf invoice barcode

Hello everyone,

I am using Anpassbares Rechnungs-Pdf to customize my invoice in oxid shop. I am trying to put barcode infront of every ordered product in deliverynote.
I have successfuly got the ean number onto the pdf, now I want to put image link like this
https://bwipjs-api.metafloor.com/?bcid=ean13&scaleY=1&text=4251823500185&includetext .
I see that the logo is added to the pdf using $opdf -> image($myConfig->getImageDir() . ‘/pdf_logo.jpg’, …)
but how can i put link as src of image in this situation.

Regards

Hello @Mutayyab_Usama and welcome to the forums!

Apparently, you are talking about a module - which one, where did you get it from? My first attempt would to query the vendor of this module for support if possible.

the pdf invoice is generated with TCPDF Libry.
You might have a look at official code examples:

@Marco https://www.web-grips.de/oxid-module-kostenlos--paket#cont2124

1 Like

Dear Marco,

Thank you for the welcome and reply.

I am using Anpassbares Rechnungs-Pdf by Web-grips.

I also queried with their support but still no answer.

Regards

Dear Vanilla,

thank you for your reply.

I looked at examples. I am using Anpassbares Rechnungs-pdf by Web-grips.

I want to use this barcode api https://bwipjs-api.metafloor.com/?bcid=ean13&scaleY=1&text=4251823500185&includetext

with text part as dynamic.

I need a way to do something like

$oPdf->image(‘https://bwipjs-api.metafloor.com/?bcid=ean13&scaleY=1&text=4251823500185&includetext’, $iMargin, 10, $aSize[0] * 0.2, $aSize[1] * 0.2, ‘’);

Regards

have you looked at the examples?
There is literally a ready-to-copy-paste code for including ean13 barcodes without having to use external api.
Also, in image examples you can find an example for using image from data stream , just fetch the image from url and you are done.

Dear Vanilla,

I have tried, but i am unable to do it. Can you share lines of code?
Regards

sure:

$imageurl = "https://bwipjs-api.metafloor.com/?bcid=ean13&scaleY=1&text=4251823500185&includetext";
$oPdf->image($imageurl, 100, 10, 210*0.5, 79*.5, 'PNG');

Thank you so much,

I tried the same many times but it was not working, now it does.

Just one more question. How can i add $oOrderArt->oxorderarticles__oxurldesc->value in place of 4251823500185.

The following is not working.
$imageurl = “https://bwipjs-api.metafloor.com/?bcid=ean13&scaleY=1&text="’.$oOrderArt->oxorderarticles__oxurldesc->value.’"&includetext”;

in theory it should work, but cant say why does not, since i dont know your article data.
You might need to urlencode the value, if there are special chars or spaces.
Do you get any errors?

$oOrderArt->oxorderarticles__oxurldesc->value has the same string 4251823500185.
What could be the error?

i just copied your code without changing anything and it works for me.
Try to find a proper error message.

Hi, i dont know if you want to give us the url… but when i use the url in the browser, following message appears:
“Error: bwipp.ean13badLength: EAN-13 must be 12 or 13 digits”

So, it should work, if you follow the strikt rules for a EAN13 Code. At the moment, we do not know how you use this field. If you have letters in it or other the numers which does not 12 or 13 digits, it will not work. Depending what you want to do, you should better use a barcode with Code 39.
cya

Dear Vanilla,

I am able to print EAN number using $oPdf->text(160, $iStartPos, $oOrderArt->oxorderarticles__oxurldesc->value); but when i try to put barcode dynamically using
$imageurl = “https://bwipjs-api.metafloor.com/?bcid=ean13&height=4&width=1&paddingbottom=10&text=“‘$oOrderArt->oxorderarticles__oxurldesc->rawValue’”&includetext”;
It does not download pdf anymore.

And since i am new to oxid, how can i check errors?

Regards

open the browser console and check the network tab, there is a request for generating pdf. The error might be in request response or in error log

Thanks for your help,

the following solved my problem.

$imageurl = ‘https://bwipjs-api.metafloor.com/?bcid=ean13&height=4&width=1&paddingbottom=30&text=’.$oOrderArt->oxorderarticles__oxurldesc->value.’’;

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.