Render to PDF using package:pdf/widgets.dart #1424
hadjiprocopis
started this conversation in
Ideas
Replies: 2 comments
-
|
Can you build a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My problem is that I need to display HTML in a widget and also print it (to PDF). Here is my case in detail: https://stackoverflow.com/questions/79484742/render-widget-content-to-pdf-or-render-html-to-widget-and-pdf-consistently
HtmlWidgetworks well (thank you!) with my simple HTML (which contains lists and paragraphs and colored text as<span>with different css classes). The css classes are handled well withcustomStylesBuilder: (element) { ...}.However,
HTMLToPdf()from packagehtmltopdfwidgetsrenders the same HTML to PDF but it looks different thanHtmlWidgetcontents. Additionally, I have not found a way to handle css classes like I do withHtmlWidget.The first thing in mind when pressing the print icon on a GUI is that what you see inside the widget is what it will come out in the printer. Consistent rendering. But I fail to see that with my flutter app. (Apropos, that was very easy with rendering
divcontents to PDF in HTML).The
pdfflutter package takes a list of widgets which then it renders to PDF. AndHTMLToPdf()(from packagehtmltopdfwidgets) returns a list of such widgets. These widgets are AFAICS a mirror of the common flutter widgets under their own namespace (in below code, that'spw).My question is, can
HtmlWidgetmade to return a list ofpdfwidgets instead? Then its content can be rendered to PDF.Where do I start?
Beta Was this translation helpful? Give feedback.
All reactions