DavBfr / dart_pdf

Pdf creation module for dart/flutter
https://pub.dev/packages/pdf
Apache License 2.0
1.42k stars 632 forks source link

Margin error when using convertHtml on some devices #1694

Open TranQuan289 opened 4 months ago

TranQuan289 commented 4 months ago

I'm getting a margin error on some devices, it's not recognizing my margin, it seems to be related to the webview being different on each device. After I corrected the line Double.valueOf(marginLeft 1000.0).intValue(), become Double.valueOf(marginLeft 1000.0 / 72.0).intValue(), then it stopped erroring and received my margin. Does anyone have the same problem as me? image

WinterPearl2k2 commented 4 months ago

I tried forcing the library version and dividing the marginLeft by 72, and it worked as I expected. I think the problem was that the marginLeft * 1000 pushed the content too far, which seems to cause issues in native code and prevented it from printing correctly. I tried it, and it worked successfully.