AsciidoctorJ + Springboot + custom style/theme
Posted by Jeno on Jun 21, 2019; 1:12pm
URL: https://discuss.asciidoctor.org/AsciidoctorJ-Springboot-custom-style-theme-tp6964.html
Hi guys,
Is there any way to set a custom css style that would be used during PDF generation? The app is a springboot app, provides an HTTP endpoint. POSTing data to this endpoint supposed to convert adoc template filled with data received in the request to PDF that would be sent in the HTTP response. The conversation works in memory, using String and ByteArrayOutputStream.
I tried to set the custom css file in the adoc template, like:
:stylesheet: theme.css
And I also tried to set the stylesheet "programatically", like:
asciidoctor.convert(inStr, OptionsBuilder.options()
.inPlace(true)
.safe(SafeMode.UNSAFE)
.attributes(AttributesBuilder.attributes()
.styleSheetName("theme.css")
.stylesDir("."))
.backend("pdf").toStream(baos))
(as the stylesDir, I tried several settings - even the absolute path to the custom theme.css file, but it didn't work)
None of these worked - any ideas about the possible solution?
Thanks,
J.