feat(转换能力): 新增批量转换功能
build.yaml / build (push) Successful in 41s

This commit is contained in:
xiaoqidun committed 2026-09-26 13:39:15 +08:00
1 parent d9046af3b0
commit ecf221c1c0
12 files changed
+1222 -30

No files matched your search

+3 -20
View File
@@ -137,12 +137,7 @@ type PageSVG struct {
}
// ExportFormat 导出格式
type ExportFormat struct {
Value string `json:"value"`
Label string `json:"label"`
Extension string `json:"extension"`
MIME string `json:"mime"`
}
type ExportFormat = ofdgo.OutputFormat
// SignatureInfo 签名验证信息
type SignatureInfo struct {
@@ -257,16 +252,6 @@ type EncryptionInfo struct {
Layers int `json:"layers,omitempty"`
}
// supportedExportFormats 导出格式列表
var supportedExportFormats = []ExportFormat{
{Value: "pdf", Label: "PDF", Extension: "pdf", MIME: "application/pdf"},
{Value: "svg", Label: "SVG", Extension: "svg", MIME: "image/svg+xml"},
{Value: "eps", Label: "EPS", Extension: "eps", MIME: "application/postscript"},
{Value: "png", Label: "PNG", Extension: "png", MIME: "image/png"},
{Value: "jpg", Label: "JPG", Extension: "jpg", MIME: "image/jpeg"},
{Value: "txt", Label: "TXT", Extension: "txt", MIME: "text/plain"},
}
// Open 打开浏览器内存中的OFD文档
// 入参: data OFD文件数据, opts 打开选项
// 返回: *Session 文档会话, error 错误信息
@@ -676,9 +661,7 @@ func (s *Session) pageBox(index int, page *ofdgo.PageContent) (ofdgo.Box, error)
// ExportFormats 获取导出格式
// 返回: []ExportFormat 导出格式列表
func ExportFormats() []ExportFormat {
formats := make([]ExportFormat, len(supportedExportFormats))
copy(formats, supportedExportFormats)
return formats
return ofdgo.OutputFormats()[1:]
}
// exportFormat 获取导出格式
@@ -689,7 +672,7 @@ func exportFormat(value string) (ExportFormat, bool) {
if value == "jpeg" {
value = "jpg"
}
for _, format := range supportedExportFormats {
for _, format := range ExportFormats() {
if format.Value == value {
return format, true
}