Генерация PDf, Free-marker и java не генерируют вывод динамического html текста в отформатированном виде.В Pdf печать с HTML-тегами вместо форматирования - PullRequest
0 голосов
/ 26 сентября 2019

Невозможно напечатать html-динамический текст в формате PDF.Печать непосредственно того же текста с тегами, а не формат.Например, хотите этот "<P>this is new para</P><p>this is another para</p>" текст в PDF как

это новый пункт, это другой пункт

Но печать на PDF как есть, т.е.это еще один пункт - <p>this is new para</p> <p>this is another para</p>

- код конфигурации Java -

@Bean 

public FreeMarkerConfigurer freemarkerConfig () {FreeMarkerConfigurer freemarkerConfiguration = new FreeMarkerConfigurer ();//freeMarkerConfigurer.setTemplateLoaderPath(FreeMarkerProperties.DEFAULT_TEMPLATE_LOADER_PATH "");freemarkerConfiguration.setTemplateLoaderPaths ("classpath *: / templates /", "classpath: /", "classpath:");/ * окончательные свойства properties = new Properties ();properties.put ("output_format", "CSS");freemarkerConfiguration.setFreemarkerSettings (properties); / // freemarkerConfiguration.setTemplateLoaderPath ("classpath : / templates /");/freemarker.template.Configuration configuration = новый freemarker.template.Configuration (freemarker.template.Configuration.VERSION_2_3_28);configuration.setOutputFormat (HTMLOutputFormat.INSTANCE);freemarkerConfiguration.setConfiguration (configuration); / return freemarkerConfiguration;}


Код BodyMap

 String str = "<p><span style=\"color: black;\">Did the Permittee excess emissions and monitoring systems summary report include the following information:</span></p><p><span style=\"color: black;\"> </span></p><ul><li><span style=\"color: black;\">The magnitude of excess emissions computed, any conversion factor(s) used, and the date and time of commencement and completion of each time period of excess emissions. The process operating time during the&nbsp;</span></li><li><span style=\"color: black;\">reporting period.</span></li></ul><p><br></p><p><sup style=\"color: black;\">lkjkljkl </sup><span style=\"color: black;\">kjkjhkj </span><sup style=\"color: black;\">lkjlkj</sup></p><ol><li><sup style=\"color: black;\">lkj</sup></li><li><sup style=\"color: black;\">ljkl</sup></li></ol><p><sup style=\"color: black;\"><span class=\"ql-cursor\"></span></sup></p>";

LOGGER.info("str : "+str);
bodyContentsMap.put("testToPrint",str );

- Код в файл .ftlh -

${testToPrint}

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...