Class PdfReportSubsets
java.lang.Object
io.leandev.appfuse.report.PdfReportSubsets
從已保存的 PDF 擷取選取的頁面(REP-08)
每次請求即時擷取成暫存 ReportArtifact,交給 ReportResponses.inline 寫出後刪除;不保存 subset。
授權、資料範圍與保存期限由應用在呼叫前完成:不存在或無權讀取回 404,已知過期回 410。
var report = reports.findReadable(id);
ReportResponses.inline(
PdfReportSubsets.extract(fileStorage, report.partition(), report.fileId(), ReportPages.parse(pages)),
request, response);
保留規則:保留頁面外觀、允許清單內的 annotation(去除 action)、http/https/mailto 連結(重建 URI action) 與文件資訊;移除 outline、內部連結、互動表單(先 flatten)與其他主動內容;頁碼標籤設為原 physical page。
subset 是列印用的節錄,不是未選取頁的保密隔離:原 PDF 若把共用資源放在頁面樹上層,只在未選取頁使用的 資源仍可能被寫入。授權以整份報表為單位。
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ReportArtifactextract(FileStorage storage, String partition, String fileId, ReportPages pages) 擷取頁面
-
Method Details
-
extract
public static ReportArtifact extract(FileStorage storage, String partition, String fileId, ReportPages pages) 擷取頁面- Parameters:
storage- 檔案儲存partition- 儲存分區鍵fileId- 原始報表的 fileIdpages- 選頁- Returns:
- 暫存產物;呼叫者負責關閉,或交給
ReportResponses - Throws:
NotFoundException- 分區內沒有此 fileId(包含已過期刪除)ReportPageSelectionException- 頁碼超出原始 PDF 的頁數IllegalStateException- classpath 上沒有 PDFBox、原始檔已加密、不是可解析的 PDF,或含無法保留外觀的表單UncheckedIOException- 讀取儲存或寫出暫存檔失敗
-