You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is First time i use dompdf in my laravel project my custom paper size is 1.5inc/4cm. but i can not do it properly. my code is $html = '<style type="text/css">
.label {
width: 152px;
height: 95px;
font-size: 12pt;
font-family: Sans-serif;
text-align: center;
margin: 0px;
}
.test {
margin-bottom: 1px;
text-align: center;
transform: rotate(-90deg);
}
.barcode {
display: block;
margin-top: 3px;
transform: rotate(-90deg);
text-align: center;
}
</style>';
// Loop through the quantity and generate barcode labels
for ($i = 1; $i <= $quantity; $i++) {
// ... (your existing code for label generation)
$barcode = $request->input('barcode');
$product = $request->input('productid');
$productname = Productinfo::where('productid', $product)->first()->productname ?? null;
$cprice = $request->input('cprice');
// Generate the barcode SVG and convert it to PNG
$barcode_svg = DNS1D::getBarcodeSVG($barcode, 'C128', 1.0, 40);
$barcode_png = base64_encode($barcode_svg);
$barcode_src = 'data:image/png;base64,' . $barcode_png;
$labelHtml = '<div class="label">
<div class="test">
<div style="margin-top: 0px; font-size: 9pt; font-weight: bold; font-family:Fjalla; margin-bottom: 1px">
'.substr($productname, -17).'
<span style="font-size:10pt; padding:5px">Price: '.$cprice.' Tk</span>
<div class="barcode">
<img src="'.$barcode_src.'">
</div>
</div>
</div>';
$html .= $labelHtml;
}
$html .= '</div>';
// Create a new Dompdf instance
$pdf = new Dompdf();
$options = new Options();
$options->set('isHtml5ParserEnabled', true);
$options->set('isPhpEnabled', true);
$options->set('width', '1.5in'); // Set the width in inches
$options->set('height', '4cm'); // Set the height in centimeters
$pdf->setOptions($options);
// Set the PDF content and options
$pdf->loadHtml($html);
$pdf->setPaper('custom', 'portrait');
$pdf->render();
$pdf->stream('document.pdf', array('Attachment' => 0));
The text was updated successfully, but these errors were encountered:
I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf
Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.
This is just a Dompdf wrapper!
I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf
Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters/images/html etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.
This is First time i use dompdf in my laravel project my custom paper size is 1.5inc/4cm. but i can not do it properly. my code is $html = '<style type="text/css">
.label {
width: 152px;
height: 95px;
font-size: 12pt;
font-family: Sans-serif;
text-align: center;
margin: 0px;
}
The text was updated successfully, but these errors were encountered: