Skip to content

Commit

Permalink
Add a SetContent method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 19, 2025
1 parent a97a7bb commit eb5f318
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qrcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,14 @@ func (q *QRCode) PNG(size int) ([]byte, error) {
return b.Bytes(), nil
}

// SetContent sets up the qrcode to be reused with new content and level.
// This behaves the same as creating a new qr code with .New().
func (q *QRCode) SetContent(content string, level RecoveryLevel) error {
q.Content = content
q.Level = level
return q.new()
}

// Write writes the QR Code as a PNG image to io.Writer.
//
// size is both the image width and height in pixels. If size is too small then
Expand Down

0 comments on commit eb5f318

Please sign in to comment.