f
This commit is contained in:
@@ -46,10 +46,8 @@ func (s *ReportPDFService) GenerateReportPDF(ctx context.Context, orderId, order
|
||||
var pdfBuf []byte
|
||||
err := chromedp.Run(ctxt,
|
||||
chromedp.Navigate(reportURL),
|
||||
// 等待报告根节点渲染完成
|
||||
chromedp.WaitVisible(`.pc-report-page`, chromedp.ByQuery),
|
||||
// 再等待一小段时间以便异步数据加载
|
||||
chromedp.Sleep(500*time.Millisecond),
|
||||
// 等待报告主体区域渲染完成(数据加载并成功渲染后才会出现)
|
||||
chromedp.WaitVisible(`.pc-report-body`, chromedp.ByQuery),
|
||||
chromedp.ActionFunc(func(ctx context.Context) error {
|
||||
buf, _, pdfErr := page.PrintToPDF().
|
||||
WithPrintBackground(true).
|
||||
|
||||
Reference in New Issue
Block a user