github.com/signintech/pdft@v0.5.0/minigopdf/cache_content_line.go (about)

     1  package gopdf
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  )
     7  
     8  type cacheContentLine struct {
     9  	pageHeight float64
    10  	x1         float64
    11  	y1         float64
    12  	x2         float64
    13  	y2         float64
    14  }
    15  
    16  func (c *cacheContentLine) toStream(protection *PDFProtection) (*bytes.Buffer, error) {
    17  	var buff bytes.Buffer
    18  	h := c.pageHeight
    19  	x1 := c.x1
    20  	y1 := c.y1
    21  	x2 := c.x2
    22  	y2 := c.y2
    23  	buff.WriteString(fmt.Sprintf("%0.2f %0.2f m %0.2f %0.2f l s\n", x1, h-y1, x2, h-y2))
    24  	return &buff, nil
    25  }