mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 08:46:55 +08:00
1 parent
627a06cda3
commit
a2de650b52
31 files changed
+2166
-249
No files matched your search
@@ -20,7 +20,9 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"io"
|
||||
"maps"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/tdewolff/canvas"
|
||||
cimage "github.com/tdewolff/canvas/image"
|
||||
@@ -32,6 +34,7 @@ import (
|
||||
// pdfRenderer PDF渲染器
|
||||
type pdfRenderer struct {
|
||||
*pdf.PDF
|
||||
information pdfgo.Dictionary
|
||||
glyphPaths renderCache[*canvas.Path, *canvas.Path]
|
||||
fonts map[*canvas.Font]*canvas.Font
|
||||
cffFonts map[*canvas.Font][]*pdfFontSubset
|
||||
@@ -159,7 +162,14 @@ func (r *pdfRenderer) writePDF(ctx context.Context, data []byte, writer io.Write
|
||||
if r.imageError != nil {
|
||||
return r.imageError
|
||||
}
|
||||
information := maps.Clone(r.information)
|
||||
if information == nil {
|
||||
information = make(pdfgo.Dictionary)
|
||||
}
|
||||
information["Producer"] = pdfgo.String(ofdCreator)
|
||||
information["CreationDate"] = pdfgo.String(time.Now().UTC().Format("D:20060102150405Z"))
|
||||
options := codecpdf.WriteOptions{
|
||||
Information: information,
|
||||
Images: r.images,
|
||||
Text: r.text,
|
||||
ExactImages: r.exactImages,
|
||||
|
||||
Reference in new issue
Block a user