Skip to content

Commit

Permalink
Added metered key setting to a couple of examples where it was missin…
Browse files Browse the repository at this point in the history
…g. (#248)
  • Loading branch information
anovik committed Apr 22, 2024
1 parent 8a0f752 commit ea53d68
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
21 changes: 11 additions & 10 deletions text/pdf_highlight_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ import (
"fmt"
"os"
"strings"

"github.com/unidoc/unipdf/v3/common/license"
"github.com/unidoc/unipdf/v3/creator"
"github.com/unidoc/unipdf/v3/extractor"
"github.com/unidoc/unipdf/v3/model"
)

func init() {
// Make sure to load your metered License API key prior to using the library.
// If you need a key, you can sign up and create a free one at https://cloud.unidoc.io
err := license.SetMeteredKey(os.Getenv(`UNIDOC_LICENSE_API_KEY`))
if err != nil {
panic(err)
}
}

func main() {
// Make sure to enter a valid license key.
// Otherwise the code will exit with a panic error.
// License keys are available via: https://unidoc.io
/*
license.SetLicenseKey(`
-----BEGIN UNIDOC LICENSE KEY-----
...key contents...
-----END UNIDOC LICENSE KEY-----
`)
*/
if len(os.Args) < 4 {
fmt.Printf("Usage: go run pdf_highlight_text.go <input.pdf> <output.pdf> <term> \n")
os.Exit(0)
Expand Down
10 changes: 10 additions & 0 deletions text/pdf_search_replace_advanced.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ import (
"strings"

"github.com/unidoc/unipdf/v3/common"
"github.com/unidoc/unipdf/v3/common/license"
"github.com/unidoc/unipdf/v3/contentstream"
"github.com/unidoc/unipdf/v3/core"
"github.com/unidoc/unipdf/v3/model"
"github.com/unidoc/unipdf/v3/model/optimize"
)

func init() {
// Make sure to load your metered License API key prior to using the library.
// If you need a key, you can sign up and create a free one at https://cloud.unidoc.io
err := license.SetMeteredKey(os.Getenv(`UNIDOC_LICENSE_API_KEY`))
if err != nil {
panic(err)
}
}

type textChunk struct {
font *model.PdfFont
strObj *core.PdfObjectString
Expand Down

0 comments on commit ea53d68

Please sign in to comment.