url的这两个部分可以参考下面的通用方式来获取,这边是在10.1高版本测试的,您在V7再测试一下。
- const baseUrl = `${Forguncy.Helper.SpecialPath.getBaseUrl()}`;
- let fileName = Forguncy.Page.getCell("filepreviewer").getValue();
- if (fileName.endsWith("|")) {
- fileName = fileName.substring(0, fileName.length-1);
- }
- const pdfUrl = `${baseUrl}FileDownloadUpload/Download?file=${fileName}`;
- // 使用 print-js 打印 PDF 文件
- printJS({
- printable: pdfUrl,
- type: 'pdf',
- showModal: true, // 显示打印预览
- style: `
- @media print {
- @page { size: A4; margin: 20px; }
- body { margin: 0; }
- }
- `
- });
复制代码
|