mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 01:27:26 +08:00
1 parent
f3cc35e78c
commit
83159a475c
6 files changed
+36
-36
No files matched your search
+12
-12
@@ -28,6 +28,18 @@ import (
|
||||
"github.com/xiaoqidun/pdfgo"
|
||||
)
|
||||
|
||||
// StencilImage 按当前填充色读取模板图像,不分配整幅彩色样本
|
||||
type StencilImage struct {
|
||||
Source image.Image
|
||||
Fill color.NRGBA64
|
||||
}
|
||||
|
||||
// NativeImage 按源像素输出原生过程色,不分配完整显示颜色缓冲
|
||||
type NativeImage struct {
|
||||
Source *pdfgo.ImageProcess
|
||||
Space *pdfgo.ColorSpace
|
||||
}
|
||||
|
||||
// EncodeCMYKTIFF 将直接四色图像保存为十六位无损TIFF,不经过显示颜色转换
|
||||
// 入参: ctx 取消上下文, source PDF源图像
|
||||
// 返回: []byte 含ICC和非预乘透明度的TIFF,非四色图像为nil, error 解码或编码错误
|
||||
@@ -143,18 +155,6 @@ func EncodeCMYKTIFF(ctx context.Context, source *pdfgo.Image) ([]byte, error) {
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// StencilImage 按当前填充色读取模板图像,不分配整幅彩色样本
|
||||
type StencilImage struct {
|
||||
Source image.Image
|
||||
Fill color.NRGBA64
|
||||
}
|
||||
|
||||
// NativeImage 按源像素输出原生过程色,不分配完整显示颜色缓冲
|
||||
type NativeImage struct {
|
||||
Source *pdfgo.ImageProcess
|
||||
Space *pdfgo.ColorSpace
|
||||
}
|
||||
|
||||
// ColorModel 保留填充色和模板的有效采样精度
|
||||
// 返回: color.Model 非预乘颜色模型
|
||||
func (s *StencilImage) ColorModel() color.Model {
|
||||
|
||||
@@ -253,7 +253,7 @@ func (e *NativeEngine) Close() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Input 读取授权源并以宿主报告的大小为准
|
||||
// input 读取授权源并以宿主报告的大小为准
|
||||
func (e *NativeEngine) input(ctx context.Context, value any) (io.ReaderAt, int64, error) {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, 0, err
|
||||
|
||||
+8
-8
@@ -31,6 +31,14 @@ import (
|
||||
"github.com/emmansun/gmsm/smx509"
|
||||
)
|
||||
|
||||
// 加密错误可通过errors.Is识别,不包含口令或私钥
|
||||
var (
|
||||
ErrCredentialsRequired = errors.New("document credentials required")
|
||||
ErrInvalidCredentials = errors.New("invalid credentials or damaged encrypted document")
|
||||
ErrUnsupportedEncryption = errors.New("unsupported document encryption")
|
||||
ErrEncryptionPolicyRequired = errors.New("explicit encryption policy required")
|
||||
)
|
||||
|
||||
// Credentials 解密凭据,UserName用于筛选接收者,留空自动匹配,不参与口令派生;证书采用DER编码
|
||||
// Password与Decrypter分别用于口令和证书方案,私钥可由外部密码设备持有
|
||||
type Credentials struct {
|
||||
@@ -97,14 +105,6 @@ type encryptionState struct {
|
||||
// GMCryptoProvider 使用纯Go国密实现,可在原生环境和WASM使用
|
||||
type GMCryptoProvider struct{}
|
||||
|
||||
// 加密错误可通过errors.Is识别,不包含口令或私钥
|
||||
var (
|
||||
ErrCredentialsRequired = errors.New("document credentials required")
|
||||
ErrInvalidCredentials = errors.New("invalid credentials or damaged encrypted document")
|
||||
ErrUnsupportedEncryption = errors.New("unsupported document encryption")
|
||||
ErrEncryptionPolicyRequired = errors.New("explicit encryption policy required")
|
||||
)
|
||||
|
||||
// WithCredentials 添加解密凭据,多次调用可解开多层加密
|
||||
// 入参: credentials 解密凭据
|
||||
// 返回: ReaderOption 阅读选项
|
||||
|
||||
@@ -32,6 +32,9 @@ const (
|
||||
pdfTransferShape uint8 = 16
|
||||
)
|
||||
|
||||
// pdfCompositeTileSize 限定单次合成块的像素边长
|
||||
const pdfCompositeTileSize = codecpdf.CompositeTileSize
|
||||
|
||||
// pdfCompositeNode 保留局部合成所需的原始图元和透明组层级
|
||||
type pdfCompositeNode struct {
|
||||
path *pdfgo.PathMark
|
||||
@@ -142,9 +145,6 @@ type pdfCompositeCache struct {
|
||||
groups map[*pdfgo.GroupMark]Box
|
||||
}
|
||||
|
||||
// pdfCompositeTileSize 限定单次合成块的像素边长
|
||||
const pdfCompositeTileSize = codecpdf.CompositeTileSize
|
||||
|
||||
// pdfCompositeScratch 复用像素及蒙版缓冲,不跨页持有活动内容
|
||||
type pdfCompositeScratch struct {
|
||||
pixels codecpdf.CompositeBuffers[pdfCompositePixel]
|
||||
|
||||
+3
-3
@@ -28,6 +28,9 @@ import (
|
||||
"github.com/xiaoqidun/pdfgo"
|
||||
)
|
||||
|
||||
// errPDFMediaRead 标识媒体读取失败,避免作为可恢复的导航问题忽略
|
||||
var errPDFMediaRead = errors.New("PDF media read failed")
|
||||
|
||||
// pdfMediaFileKey 区分媒体文件及注册用途,避免重复解码或调用文件解析器
|
||||
type pdfMediaFileKey struct {
|
||||
Stream *pdfgo.Stream
|
||||
@@ -59,9 +62,6 @@ type pdfAttachmentKey struct {
|
||||
digest [32]byte
|
||||
}
|
||||
|
||||
// errPDFMediaRead 标识媒体读取失败,避免作为可恢复的导航问题忽略
|
||||
var errPDFMediaRead = errors.New("PDF media read failed")
|
||||
|
||||
// mediaInstance 为播放目标分配独立标识,同一目标的动作继续共用控制状态
|
||||
// 入参: id 已注册的媒体资源, target 目标注解, page 所属页面索引
|
||||
// 返回: string 独立资源标识, error 资源复制或取消错误
|
||||
|
||||
+9
-9
@@ -34,6 +34,15 @@ import (
|
||||
basefile "github.com/xiaoqidun/ofdgo/internal/base/file"
|
||||
)
|
||||
|
||||
// ErrSaveTarget 表示编辑器尚未绑定保存目标
|
||||
var ErrSaveTarget = errors.New("save target is not set")
|
||||
|
||||
// ErrSaveConflict 表示保存目标在打开或最近保存后被其他操作修改
|
||||
var ErrSaveConflict = basefile.ErrChanged
|
||||
|
||||
// ErrSaveBusy 表示保存目标已有其他写入事务
|
||||
var ErrSaveBusy = basefile.ErrBusy
|
||||
|
||||
// Output 创建完整文档的输出事务,可用于文件或远程存储
|
||||
// 实现需支持并发调用Begin,按目标协调并发写入并校验版本冲突
|
||||
// Begin失败时由实现释放资源;事务持有ctx,提交前应检查取消状态
|
||||
@@ -79,15 +88,6 @@ type ofdXML struct {
|
||||
// ofdAttrs OFD节点属性
|
||||
type ofdAttrs []xml.Attr
|
||||
|
||||
// ErrSaveTarget 表示编辑器尚未绑定保存目标
|
||||
var ErrSaveTarget = errors.New("save target is not set")
|
||||
|
||||
// ErrSaveConflict 表示保存目标在打开或最近保存后被其他操作修改
|
||||
var ErrSaveConflict = basefile.ErrChanged
|
||||
|
||||
// ErrSaveBusy 表示保存目标已有其他写入事务
|
||||
var ErrSaveBusy = basefile.ErrBusy
|
||||
|
||||
// Snapshot 创建独立编辑快照,完成后可与原编辑器并行使用
|
||||
// 创建过程需与原实例串行,保留修订及保存目标,不复制撤销记录和进度回调
|
||||
// 保存目标与原实例共享,由输出实现协调并发事务及提交版本
|
||||
|
||||
Reference in new issue
Block a user