Closed huglester closed 9 years ago
Can you show me a screen shot and your code? The SVG uses XML to output and should not be showing up.
Closing this due to not hearing anything back.
@SimplyCorey That happening also to me.
I'm using mpdf to generate PDF document with the qrcode. Unfortunatelly as @huglester said the <?xml tag is shown in the PDF document :/
I'm using Laravel 5.1 with the composer.json entries:
"simplesoftwareio/simple-qrcode": "^1.3",
"mpdf/mpdf": "^6.1",
The example code is:
<p class="text-center">
{!! QrCode::size(200)->generate(Request::url()) !!}
</p>
When I return the laravel view directly to a browser then the xml tag isnt display. It display just on generated pdf document.
@BlueManLine just checking -- are you also using SVG? Have you tried this with another format like PNG?
This might be an issue with how mpdf renders SVGs and would be outside the scope of our support.
@SimplyThomas thank you for quick reply :+1: Unfortunately on other places I do not use SVG, I just want to use it with the QrCode. Finally I used the PNG format fetched by a local url, not the inline PNG image you are suggesting..
If I will have time (does any developer have time? :D) I will check the issue with other PDF generator library.
@BlueManLine Does using the PNG URL resolve your issue?
Out of curiosity, what are you building? It looks interesting.
@SimplyCorey yes, the png url resolve my issue. I can attach an extra _GET parameters to easily manipulate the size and margins, so generally I have the same possibilities as with inline qrcode (or even higher - when someday I'm going to change the qrcode library then the changes will affect just one place :))
About my project - I'm building a receipt (or actually docket) which is printing on a remote thermal printer :)
can you replace it and this code work!! $qrcode=QrCode::encoding('UTF-8')->size(50)->generate('A basic example of QR code!'); $qrcode=str_replace('<?xml version="1.0" encoding="UTF-8"?>',"",$qrcode); //replace to empty
I have the same issue i'm using "niklasravnsborg/laravel-pdf"
it prints the qrcode but XML tag printed as @BlueManLine.
Any help
I too encountered similar issue while generating pdf with mpdf library. i just checked @kopgzdevth answer and replaced the entire xml tag from my code.
$qrcode=QrCode::encoding('UTF-8')->size(50)->generate('A basic example of QR code!'); $qrcode=str_replace('<?xml version="1.0" encoding="UTF-8"?>',"",$qrcode); Edit: inline xml code is somehow replaced by editor. so I am attaching an image
I solved this problem. Qr code returns an object. At first you have to convert this to string. then slice until that portion where that xml code ends.
$qrcode=QrCode::size(50)->generate('A basic example of QR code!');
$code = (string)$qrcode;
echo substr($code,38);
this perfectly shows my qrcode without xml code
Hello,
when I echo the SVG qrcode, I also see this: <?xml version="1.0" encoding="UTF-8"?>
right before the qrcode is printed.
What could that be?
Thanks!