AndreRenaud / PDFGen

Simple C PDF Writer/Generation library
The Unlicense
506 stars 121 forks source link

Is inline colouring possible? #154

Open ghost opened 1 month ago

ghost commented 1 month ago

Lets say I wanted to emphasis or colourize mid part of the sentence.

[default black]This is an example[now red]of inline colouring[now black]within the same sentence in a PDF document.

I'm asking since you're supposed to position manually just like how it is with postscript (and in turn, PDF) creation, I feel it would be a pain to manually place multiple strings on the same line.

AndreRenaud commented 1 month ago

Hey. Yes, that would be a good feature. The absolute positioning makes that pretty tricky at the moment, so it would be better to be done automatically under the hood. It would require some kind of markdown-like parser, which might be a bit involved. Is there a simple syntax that already exists that might suit (to cover things like underline, strike through, colour etc...)?

Right now there isn't a trivial answer - you'd have to break it up yourself externally and then build each element separately with absolute positioning. Possible, but awkward.