github.com/signintech/pdft@v0.5.0/minigopdf/cache_content_image.go (about) 1 package gopdf 2 3 import ( 4 "bytes" 5 "fmt" 6 ) 7 8 type cacheContentImage struct { 9 index int 10 x float64 11 y float64 12 h float64 13 rect Rect 14 } 15 16 func (c *cacheContentImage) toStream(protection *PDFProtection) (*bytes.Buffer, error) { 17 var buff bytes.Buffer 18 buff.WriteString(fmt.Sprintf("q %0.2f 0 0 %0.2f %0.2f %0.2f cm /I%d Do Q\n", c.rect.W, c.rect.H, c.x, c.h-(c.y+c.rect.H), c.index+1)) 19 return &buff, nil 20 }