pdfme / pdfme

Open-source PDF generation library built with TypeScript and React. Features a WYSIWYG template designer, PDF viewer, and powerful generation capabilities. Create custom PDFs effortlessly in both browser and Node.js environments.
http://pdfme.com/
MIT License
2.72k stars 247 forks source link

[FEATURE REQUEST]: simple rich text (bolded text between normal text) #566

Open snax4a opened 3 months ago

snax4a commented 3 months ago

Is your feature request related to a problem? Please describe.

There are use cases where normal and bolded texts are interleaved. For example such paragraph:

image

However, it seems that currently it would be pretty hard to achieve, the only idea that I have is composing it of multiple text nodes. But that feels to be painful if we would need the text wrapping.

Describe the solution you'd like

I wonder if it would require much work to implement some simple rich text features. For example something similar to PDFKit's continued option https://pdfkit.org/docs/text.html#rich_text

PDFKit supports a simple form of rich text via the continued option. When set to true, PDFKit will retain the text wrapping state between text calls. This way, when you call text again after changing the text styles, the wrapping will continue right where it left off.

Describe alternatives you've considered

Manually composing paragraph of multiple text nodes, implementing custom wrapping logic, or using PDFkit's implementation

Additional context

Have you needed something like that in the past? What was your approach?

hand-dot commented 3 months ago

Ref: https://github.com/pdfme/pdfme/issues/564