This commit is contained in:
2026-03-18 01:01:59 +08:00
parent 89c5251155
commit b672ddb2a2

View File

@@ -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).