mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2024-12-21 19:08:24 +01:00
add table support
This commit is contained in:
parent
99050ad73e
commit
ee223d0405
@ -152,6 +152,7 @@ dependencies {
|
||||
implementation group: 'com.google.zxing', name: 'core', version: '3.5.2'
|
||||
// https://mvnrepository.com/artifact/org.commonmark/commonmark
|
||||
implementation 'org.commonmark:commonmark:0.21.0'
|
||||
implementation 'org.commonmark:commonmark-ext-gfm-tables:0.17.2'
|
||||
// https://mvnrepository.com/artifact/com.github.vladimir-bukhtoyarov/bucket4j-core
|
||||
implementation 'com.github.vladimir-bukhtoyarov:bucket4j-core:7.6.0'
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
package stirling.software.SPDF.controller.api.converters;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.commonmark.Extension;
|
||||
import org.commonmark.ext.gfm.tables.TablesExtension;
|
||||
import org.commonmark.node.Node;
|
||||
import org.commonmark.parser.Parser;
|
||||
import org.commonmark.renderer.html.HtmlRenderer;
|
||||
@ -47,9 +51,10 @@ public class ConvertMarkdownToPdf {
|
||||
}
|
||||
|
||||
// Convert Markdown to HTML using CommonMark
|
||||
Parser parser = Parser.builder().build();
|
||||
List<Extension> extensions = List.of(TablesExtension.create());
|
||||
Parser parser = Parser.builder().extensions(extensions).build();
|
||||
Node document = parser.parse(new String(fileInput.getBytes()));
|
||||
HtmlRenderer renderer = HtmlRenderer.builder().build();
|
||||
HtmlRenderer renderer = HtmlRenderer.builder().extensions(extensions).build();
|
||||
String htmlContent = renderer.render(document);
|
||||
|
||||
byte[] pdfBytes =
|
||||
|
Loading…
Reference in New Issue
Block a user