Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<barcode dimension="2D" type="DATAMATRIX" ...> adds a "{" at the end of the string #503

Open
CnczubehoerEu opened this issue Sep 1, 2019 · 3 comments

Comments

@CnczubehoerEu
Copy link

commented Sep 1, 2019

I'm using the following code:

It produces me a DMCode of "AP.NSS.N10M5{" (see the bracket at the end).
"AP.NS.N10M5" works fine
"AP.NSS.N10M10" works fine as well.

Any idea? I'm looking forward to any help. Thank you!

@sclausen

This comment has been minimized.

Copy link

commented Sep 13, 2019

Unfortunately I can't see your code.

@CnczubehoerEu

This comment has been minimized.

Copy link
Author

commented Sep 14, 2019

Hi!

Thank you very much for your response. My full code looks like this:
<barcode dimension="2D" type="DATAMATRIX" value="AP.NSS.N10M5" label="label" style="position: absolute; top: 7mm; left: 1mm; width:13mm; height:13mm; color: #000000; font-size: 4mm;"></barcode>

Best regards,

Tobias

@sclausen

This comment has been minimized.

Copy link

commented Sep 14, 2019

I can't even get the example you state is working for you to work properly for me. To me it looks like DATAMATRIX doesn't work at all.
datamatrix
I assume using an ISO/IEC 16022 Data Matrix is required by the specifications of your project!?
You could use another library along with html2pdf to generate a datamatrix first and then embed it as a picture. I found out that milon/barcode does a great job.

<?php

use Spipu\Html2Pdf\Html2Pdf;
use Milon\Barcode\DNS2D;

require_once __DIR__ . '/vendor/autoload.php';

$d = new DNS2D();
$d->setStorPath(__DIR__ . '/cache/');
$base64Datamatrix = $d->getBarcodePNG('AP.NSS.N10M5', 'DATAMATRIX', 10, 10);
file_put_contents(__DIR__ . '/barcode.png', base64_decode($base64Datamatrix));

$html = '
<page>
  <img src="./barcode.png" style="position: absolute; top: 7mm; left: 1mm; width:13mm; height:13mm; color: #000000; font-size: 4mm;">
</page>
';
$html2Pdf = new Html2Pdf('P', 'A4', 'fr');
$html2Pdf->writeHTML($html);
$html2Pdf->output(__DIR__ . '/barcode.pdf', 'F');

This produces a pdf with that:
datamatrix2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.