mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +08:00
Convenience functions to create streams and indirect objects.
This commit is contained in:
parent
3586509908
commit
53b9e8b99c
@ -98,6 +98,27 @@ func MakeNull() *PdfObjectNull {
|
||||
return &null
|
||||
}
|
||||
|
||||
func MakeIndirectObject(obj PdfObject) *PdfIndirectObject {
|
||||
ind := &PdfIndirectObject{}
|
||||
ind.PdfObject = obj
|
||||
return ind
|
||||
}
|
||||
|
||||
func MakeStream(contents []byte, encoder StreamEncoder) (*PdfObjectStream, error) {
|
||||
stream := &PdfObjectStream{}
|
||||
|
||||
stream.PdfObjectDictionary = encoder.MakeStreamDict()
|
||||
|
||||
encoded, err := encoder.EncodeBytes(contents)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stream.PdfObjectDictionary.Set("Length", MakeInteger(int64(len(encoded))))
|
||||
|
||||
stream.Stream = encoded
|
||||
return stream, nil
|
||||
}
|
||||
|
||||
func (this *PdfObjectBool) String() string {
|
||||
if *this {
|
||||
return "true"
|
||||
|
Loading…
x
Reference in New Issue
Block a user