Open i-panov opened 1 week ago
@i-panov provide html sample
@alihassan143
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--body { background-color: #ffffff; font-size: 18pt; font-family: "Courier New"; font-style: normal; font-weight: normal; color: #000000; text-decoration: none;}hr { color: #000000}body, table /* Normal text */{ font-size: 18pt; font-family: "Courier New"; font-style: normal; font-weight: normal; color: #000000; text-decoration: none;}-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" font-family="Courier New" font-style=normal
text-decoration=none font-size: 12pt>
<table cellspacing="2" cellpadding="2" border="0" width="720">
<tbody>
<tr align="left">
<td><br></td>
</tr>
<tr align="left">
<td>ООО "Рога и Копыта"<br></td>
</tr>
<tr align="left">
<td>123456,г.Усть-задрищенск<br></td>
</tr>
<tr align="left">
<td>ул.Говна,12<br></td>
</tr>
<tr align="left">
<td>КАССИР: Иванова
Ольга<br></td>
</tr>
<tr align="left">
<td>КАССА: 68 ВСЧ:
00017<br></td>
</tr>
<tr align="left">
<td>ДАТА: 06.09.24 ВРЕМЯ: 15:16<br></td>
</tr>
<tr align="left">
<td>СМЕНА: 123<br>
</td>
</tr>
<tr align="left">
<td>РН ККТ: 123456789<br></td>
</tr>
<tr align="left">
<td>ЗН ККТ: 123456789<br></td>
</tr>
<tr align="left">
<td>КАССОВЫЙ ЧЕК/ПРИХОД<br></td>
</tr>
<tr align="left">
<td>ФН: 123456789<br>
</td>
</tr>
<tr align="left">
<td>ИНН: 7804064663<br>
</td>
</tr>
<tr align="left">
<td>ПОКУПАТЕЛЬ: +7912345678<br></td>
</tr>
<tr align="left">
<td>Сайт
ФНС: www.nalog.ru<br>
</td>
</tr>
<tr align="left">
<td>123456789 ТРАНСПОРТНЫЕ УСЛУГИ<br></td>
</tr>
<tr align="left">
<td>1.000 X 1299<br></td>
</tr>
<tr align="left">
<td>=1299.00_A<br></td>
</tr>
<tr align="left">
<td>012345678 кресло Салют 660x600<br></td>
</tr>
<tr align="left">
<td>1.000 X 924<br></td>
</tr>
<tr align="left">
<td>=924.00_A<br></td>
</tr>
<tr align="left">
<td>ИТОГО =2223.00<br></td>
</tr>
<tr align="left">
<td>
ЭЛЕКТРОННЫМИ =2223.00<br>
</td>
</tr>
<tr align="left">
<td>ПОЛУЧЕНО:<br></td>
</tr>
<tr align="left">
<td> БАНКОВСКАЯ КАРТА =2223.00<br></td>
</tr>
<tr align="left">
<td>А:СУММА НДС 20% =370.50<br>
</td>
</tr>
<tr align="left">
<td>СНО:ОСН ФД:24420 ФП:12345678<br></td>
</tr>
</tbody>
</table>
</body>
</html>
just remove the br tag from table than it will work
@alihassan143
HTML comes to the application from the server. Of course, I can try to automatically clean these tags in it, but it seems that this is not the best solution. On the other hand, I am not sure that I will be able to negotiate with the server so that they change the HTML on their side. Why can't your library just handle these tags correctly?
I tried to remove the br tags. Now the document is not generated empty, but for some reason there are green fields around the edges. Where do they come from? There are none in HTML. Your library obviously adds them.
Cyrillic characters are not processed correctly. The console writes errors on them. Judging by these errors, your library is trying to use the Helvetica font, which does not support Unicode. But the Courier New font is specified in HTML! Why is it not used automatically? I tried to specify the fontFallback parameter in the convert method, but it didn't help.
Helvetica has no Unicode support see https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management
Unable to find a font to draw "О" (U+41e) try to provide a TextStyle.fontFallback
@i-panov there are some restrictions in the pdf library
but things can be improved with time
I will try to create custom code embedder that allow developer to embed multiple tags handling code so they can customize their HTML code output but it will take time
@alihassan143 I see, thanks! But what about the green fields and the font?
Hello! I tried to convert HTML to PDF using your library, but the resulting document is empty.
P.S. htmltopdfwidgets: ^1.0.4, Android 14