Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use offline key with compiled binary #57

Closed
ARolek opened this issue Aug 30, 2023 · 2 comments
Closed

Unable to use offline key with compiled binary #57

ARolek opened this issue Aug 30, 2023 · 2 comments

Comments

@ARolek
Copy link

ARolek commented Aug 30, 2023

I just tried following your blog post, Compressing and Optimizing PDFs in Pure Golang using UniPDF using a compiled binary with my offline key. For example:

UNIDOC_LICENSE_FILE="unidoc_license.key" UNIDOC_LICENSE_CUSTOMER=<customer_name> unipdf license_info

And I get the following output:

License: License Id:
Customer Id:
Customer Name: Unlicensed
Tier: unlicensed
Created At: 30 August 2023 at 17:23 UTC
Expires At: Never
Creator:  <>

The keys I'm providing are used in production so I know they're correct. I then dug into your source code and I found the bug:

func SetLicense(licensePath string, customer string) error {
// Read license file
content, err := ioutil.ReadFile(licensePath)
if err != nil {
return err
}
return unilicense.SetLicenseKey(string(content), "")
}

If you look at line 24, the customer name is hard coded as an empty string. Change that line to pass the customer variable and everything works.

@sampila
Copy link
Contributor

sampila commented Aug 30, 2023

Hi @ARolek,

Thank you for posting this issue and provide the solution.

We opened the PR based on your solution #58.

Best regards

@sampila
Copy link
Contributor

sampila commented Aug 31, 2023

Hi @ARolek

As the PR #58 is merged to the master branch, we closing this issue.

Best regards

@sampila sampila closed this as completed Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants