生成pdf

parent 3bf46d55
......@@ -903,7 +903,7 @@
<div class="box0">
<div class="cover_head dtable">
<div class="dcell">
<img src="./img/logo.png" alt="" class="cover_logo">
<img src={{logo}} alt="" class="cover_logo">
</div>
<div class="dcell">
<div class="cover_line"></div>
......@@ -920,13 +920,13 @@
敬呈
</span>
<span class="cover_name">
王晶
{{customer_name}}
</span>
<span class="cover_sir">
先生
</span>
</div>
<img src="./img/cover-back.png" alt="" class="cover_back">
<img src={{cover_back}} alt="" class="cover_back">
<div class="cover_date">
<div class="cover_time">
2020.10
......@@ -985,7 +985,7 @@
</div>
<div class="page_head dcell">
<div class="dcell">
<img src="./img/logo.png" alt="" class="page_logo">
<img src={{logo}} alt="" class="page_logo">
</div>
<div class="dcell">
<div class="page_line"></div>
......@@ -1167,9 +1167,6 @@
<td>
{{value[12]["profit"]}}
</td>
<!-- <td>-->
<!-- {{value[13]["profit"]}}-->
<!-- </td>-->
</tr>
<tr>
<td>
......@@ -1211,11 +1208,6 @@
<td>
{{value[12]["net_amount"]}}
</td>
<!-- <td>-->
<!-- {{value[13]["net_amount"]}}-->
<!-- </td> <td>-->
<!-- {{value[13]["net_amount"]}}-->
<!-- </td>-->
</tr>
{%endfor%}
</table>
......@@ -1234,7 +1226,7 @@
</div>
<div class="page_head dcell">
<div class="dcell">
<img src="./img/logo.png" alt="" class="page_logo">
<img src={{logo}} alt="" class="page_logo">
</div>
<div class="dcell">
<div class="page_line"></div>
......@@ -1460,7 +1452,7 @@
</div>
<div class="page_head dcell">
<div class="dcell">
<img src="./img/logo.png" alt="" class="page_logo">
<img src={{logo}} alt="" class="page_logo">
</div>
<div class="dcell">
<div class="page_line"></div>
......@@ -1612,7 +1604,7 @@
</div>
<div class="page_head dcell">
<div class="dcell">
<img src="./img/logo.png" alt="" class="page_logo">
<img src={{logo}} alt="" class="page_logo">
</div>
<div class="dcell">
<div class="page_line"></div>
......@@ -1697,7 +1689,7 @@
</div>
<div class="page_head dcell">
<div class="dcell">
<img src="./img/logo.png" alt="" class="page_logo">
<img src={{logo}} alt="" class="page_logo">
</div>
<div class="dcell">
<div class="page_line"></div>
......@@ -1921,7 +1913,7 @@
</div>
<div class="page_head dcell">
<div class="dcell">
<img src="./img/logo.png" alt="" class="page_logo">
<img src={{logo}} alt="" class="page_logo">
</div>
<div class="dcell">
<div class="page_line"></div>
......@@ -2004,7 +1996,7 @@
<div class="financial_show dtable">
<div class="financial_left dcell">
<div class="financial_scene">
<img src="./img/scene.png" alt="" class="financial_scene_img">
<img src={{scene}}" alt="" class="financial_scene_img">
<div class="financial_scene_text">
我们挣的是⻆度和变化的钱⽽不是纠正市场错 误的钱,市场永远是正确的,关键是在其正确 被反复证明后的逆向⽽⾏,⼀定是避开它的正 确被展开的过程 。
</div>
......@@ -2015,7 +2007,7 @@
</div>
<div class="financial_show_right dcell">
<div class="financial_team">
<img src="./img/team.png" alt="" class="financial_team_img">
<img src={{team}} alt="" class="financial_team_img">
</div>
</div>
</div>
......
This diff is collapsed.
......@@ -17,7 +17,7 @@ def html_to_pdf(source_path, target_path):
'encoding': "utf-8",
# 'page-size': 'A5',
# 'page-width': '300mm',
# 'page-height': 'auto',
'page-height': '2.3mm',
'margin-top': '0mm',
'margin-right': '0mm',
'margin-bottom': '0mm',
......
......@@ -3,6 +3,7 @@ import uuid
from jinja2 import PackageLoader, Environment
from app.api.engine import work_dir, pdf_folder, template_folder
from app.service.portfolio_diagnose import portfolio_diagnose
from app.service.result_service_v2 import UserCustomerResultAdaptor
import numpy as np
......@@ -80,8 +81,6 @@ class DataIntegrate:
self.single_fund_data_list = []
portfolio_evaluation = portfolio_diagnose.old_portfolio_evaluation()
radar_chart_data = portfolio_diagnose.single_fund_radar()
print('***************************')
print(portfolio_evaluation)
for i in range(len(portfolio_evaluation)):
if portfolio_evaluation[i]['status'] == '保留':
portfolio_evaluation[i]['status'] = '<div class="self_type fl">保留</div>'
......@@ -167,8 +166,15 @@ class DataIntegrate:
def render_data(self):
# 全部数据
data = {'customer_name': self.customer_name, 'customer_gender': '女',
'year_month': '2020年10月', 'ifa_company': '飞度工作室',
data = {
'cover_back': template_folder + '/v2/img/cover-back.png',
'logo': template_folder + '/v2/img/logo.png',
'scene': template_folder + '/v2/img/scene/png',
'team': template_folder + '/v2/img/team.png',
'customer_name': self.customer_name,
'customer_gender': '女',
'year_month': '2020年10月',
'ifa_company': '飞度工作室',
'title': '10月综述', 'brand_name': '飞度工作室',
'customer_old': 42, 'customer_level': '平衡型',
# 'new_evaluation': self.new_evaluation,
......@@ -219,10 +225,10 @@ class DataIntegrate:
# with open(save_file, 'w', encoding="utf-8") as f:
# f.write(monthReport_html)
save_file = "app/html/v2/monthReportV2.html"
with open(save_file, 'w', encoding="utf-8") as f:
f.write(monthReport_html)
# html_to_pdf(monthReport_html, '/Users/pengxiong/Desktop/fund_report/app/pdf/%s.pdf' % str(uuid.uuid4()))
# save_file = "app/html/v2/monthReportV2.html"
# with open(save_file, 'w', encoding="utf-8") as f:
# f.write(monthReport_html)
html_to_pdf(monthReport_html, pdf_folder + str(uuid.uuid4()))
......
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