Commit 6a8acedd authored by hj's avatar hj

更新提交

parent 86ca96b0
...@@ -34,11 +34,12 @@ class ChemicalsMsdsService ...@@ -34,11 +34,12 @@ class ChemicalsMsdsService
} }
preg_match('/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i',$msds_html, $bodyStyle); preg_match('/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i',$msds_html, $bodyStyle);
$bodyStyle['bodyStyle'] = "<style>body{ font-family: 'msyh'; font-size: 0.8rem; font-weight: bold; display: block;} h2{font-size: 2.2rem; text-align: center;}.container { padding-right: 5px;padding-left: 5px;margin-right: auto;margin-left: auto;width: 90%;} " . $bodyStyle['bodyStyle'] = "<style>body{ font-family: 'msyh'; font-size: 0.8rem; font-weight: bold; display: block;} h2{font-size: 2.2rem; text-align: center;}.container { padding-right: 5px;padding-left: 5px;margin-right: auto;margin-left: auto;width: 90%;} .sds-cn dd p { font-weight: normal; margin-left: 15px; word-break:break-all}" .
$bodyStyle['bodyStyle']."</style><body><div class='container'>"; $bodyStyle['bodyStyle']."</style><body><div class='container'>";
// 格式化处理 // 格式化处理
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\{[\s]*?line-height: 1.5;[\s]*?\}/i', '.sds-cn{line-height: 2.5;}', $bodyStyle['bodyStyle']); $bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\{[\s]*?line-height: 1.5;[\s]*?\}/i', '.sds-cn{line-height: 2.5;}', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\.b-a[\s]*?\{[\s]*?border: 1px solid #000000;[\s]*?\}/i', '.sds-cn .b-a { border: 1px solid #000000; margin-left:10px;}', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?dd.clearfix[\s]*?\{ margin-left: 20px;[\s]*?\}/i', '.sds-cn dd.clearfix { width:80% }', $bodyStyle['bodyStyle']); $bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?dd.clearfix[\s]*?\{ margin-left: 20px;[\s]*?\}/i', '.sds-cn dd.clearfix { width:80% }', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\.list-line[\s]*?li:before[\s]*?\{ content: " —— " \}/i', '.sds-cn .list-line li:before { content: " -- " }', $bodyStyle['bodyStyle']); $bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\.list-line[\s]*?li:before[\s]*?\{ content: " —— " \}/i', '.sds-cn .list-line li:before { content: " -- " }', $bodyStyle['bodyStyle']);
...@@ -69,7 +70,7 @@ class ChemicalsMsdsService ...@@ -69,7 +70,7 @@ class ChemicalsMsdsService
if($content){ if($content){
foreach($content['cTitle'] as $k => $c){ foreach($content['cTitle'] as $k => $c){
$dlHtml .= '<div><span style="margin: 0;">'.$c.'</span>'; $dlHtml .= '<div><span style="margin: 0;">'.$c.'</span>';
$dlHtml .= '<span>'.$content['cContent'][$k].'</span></div>'; $dlHtml .= '<span style="font-weight: normal">'.$content['cContent'][$k].'</span></div>';
} }
} }
} }
...@@ -82,7 +83,7 @@ class ChemicalsMsdsService ...@@ -82,7 +83,7 @@ class ChemicalsMsdsService
//file_put_contents('./test.html', $msds_html); file_put_contents('./test.html', $msds_html);
//$msds_html = file_get_contents('./test.html'); //$msds_html = file_get_contents('./test.html');
$this->getPdfApp()->loadHTML($msds_html, 'utf-8'); $this->getPdfApp()->loadHTML($msds_html, 'utf-8');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment