File tree Expand file tree Collapse file tree
src/main/java/com/shitlime/era/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,9 +87,11 @@ private void openPage(String html) {
8787 this .page = playwrightHandle .newPage ();
8888 playwrightHandle .navigate (this .page , pageFile );
8989 } else {
90- this .page .evaluate (String .format (
91- "document.open();document.write(\" %s\" );document.close();" ,
92- html .replace ("\" " , "\\ \" " )));
90+ this .page .evaluate ("htmlContent => { " +
91+ "document.open(); " +
92+ "document.write(htmlContent); " +
93+ "document.close(); " +
94+ "}" , html );
9395 }
9496 }
9597
@@ -140,7 +142,7 @@ private String buildPage(PageSettingDTO page) {
140142 builder .append ("<style>" );
141143 // 字体
142144 for (String font : page .getFontList ()) {
143- builder .append (String .format ("@font-face{font-family:'MyFont';src:url('%s');}" , font ));
145+ builder .append (String .format ("@font-face{font-family:'MyFont';src:url('file:/// %s');}" , font ));
144146 }
145147 builder .append ("body{font-family:Arial,'MyFont';}" );
146148 builder .append ("#show{" );
You can’t perform that action at this time.
0 commit comments