HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML Forums › Technical questions / Troubleshooting › HTML CSS styles into RTF
- This topic has 6 replies, 3 voices, and was last updated Jul 06, 2023
12:09:41 by lawassignmentoconnor.
-
AuthorPosts
-
July 4, 2023 at 17:39#36650
Is there a way to keep CSS style defined in the HTML file when exporting in RTF, transformed in a RTF paragraph or character formatting style?
July 4, 2023 at 18:33#36651In most cases, it retains such styles. However, some of the styles simply don’t have RTF equivalents; some require tricky solutions like defining paragraph borders. The RTF format does not directly support paragraph borders, so if it is requested, PD4ML will implicitly convert the paragraph to a table cell (which supports borders).
July 4, 2023 at 18:44#36652I meant a transformation between CSS styles and rich formatting styles, e.g. in the HTML file there is the paragraph style identified by the X class and in the RTF file, among the available styles, there is the X style. Something like this.
So when I use a certain CSS class in a HTML paragraph I will found the same text paragraph, in the RTF, with the named style imported from CSS.
Attachments:
You must be logged in to view attached files.July 4, 2023 at 18:58#36654Currently all document styles are already applied to RTF elements/content blocks. And you would like to see HTML’s CSS converted to an editable RTF document stylesheet, and if you edit it in MS Word it will impact all relevant RTF content blocks. Right? Please correct if I am wrong
Or you simply cannot get needed style applied to particular RTF content, while for PDF output it works
July 5, 2023 at 11:39#36660you would like to see HTML’s CSS converted to an editable RTF document stylesheet, and if you edit it in MS Word it will impact all relevant RTF content blocks. Right? Please correct if I am wrong
Yes! So when I define a paragraph style in the html document CSS, I will found the same paragraph style in the RTF document stylesheet.
I’m considering pd4ml for my software ( https://librogamecreator.wordpress.com/ ) and it would be very useful to have such a feature, so writers don’t have to go back to LGC, change CSS, export to RTF, all over again , whenever they need to change each paragraph to a certain style.
July 5, 2023 at 13:04#36663Hmm… It is not the feature can be easily implemented. It cannot take the original CSS styles (the used in source HTML/CSS sizes/dimensions change itself depending on conversion scale factor, see https://pd4ml.com/support-topics/pd4ml-v4-programmers-manual/#customizing) and there is no possibility to export the initial original stylesheet rules/properties, aligned depending on conversion params.
It seems like the only possible way is to go through all the HTML elements and find repeating styles (after the style and scaling is applied); if there are matches, to synthesize a style sheet from them with arbitrary class names.
I’ve added the feature request for future releases. Not sure if we can address it within the next couple of months
July 6, 2023 at 12:09#36666Is there a way to keep CSS style defined in the HTML file when exporting in RTF, transformed in a RTF paragraph or character formatting style?
-
AuthorPosts
You must be logged in to reply to this topic.