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

Reading license file failed #11

Closed
Veeraops opened this issue Oct 11, 2023 · 20 comments
Closed

Reading license file failed #11

Veeraops opened this issue Oct 11, 2023 · 20 comments

Comments

@Veeraops
Copy link

Hi Team,

Below licensekey issue is coming while running docker command
sudo docker run -p 8085:8085 -e UNIHTML_LICENSE_PATH='/home/ec2-user/UnidocLicense.key' -e UNIHTML_CUSTOMER_NAME=Cashe_Software unidoccloud/unihtml

Err: reading license file failed: open /home/ec2-user/UnidocLicense.key: no such file or directory

We have UnidocLicence key and verified the license file's location, file permissions, and ownership, but still encountering the issue.
Could you please help us to resolve this issue as soon as possible.

@github-actions
Copy link

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/

@Veeraops
Copy link
Author

Hi Team,
Could you please help us to resolve this issue asap

@sampila
Copy link
Collaborator

sampila commented Oct 16, 2023

Hi @Veeraops,

This strange, probably can rename the file "UnidocLicense.key" into "UnidocLicense"? and try to remove the tick (') mark, so it will became like this

UNIHTML_LICENSE_PATH=/home/ec2-user/UnidocLicense

@Veeraops
Copy link
Author

@sampila
Thanks a lot for the help and still we are getting the same error.
sudo docker run -p 8080:8080 -e UNIHTML_LICENSE_PATH=/home/ec2-user/UnidocLicense -e UNIHTML_CUSTOMER_NAME=cashesoftware unidoccloud/unihtml
Err: reading license file failed: open /home/ec2-user/UnidocLicense: no such file or directory

Could you please help us to resolve this issue

@sampila
Copy link
Collaborator

sampila commented Oct 17, 2023

Hi @Veeraops,

Could you try this command on terminal

find $PWD -type f -name UnidocLicense

That will give result the path of UnidocLicense.

@Veeraops
Copy link
Author

Veeraops commented Oct 17, 2023

Hi @sampila
We have followed below actions
Checked the specified license file path to ensure it exists.

find $PWD -type f -name UnidocLicense
/home/ec2-user/UnidocLicense

Verified the file permissions for the license file.
Attempted to use alternate file paths for the license.
Unfortunately, these efforts have not yet led to a resolution. We believe that your expertise and guidance may be crucial in addressing this problem.

@sampila
Copy link
Collaborator

sampila commented Oct 17, 2023

@Veeraops have you set the env variable for UNIPDF_LICENSE_PATH and UNIPDF_CUSTOMER_NAME?

@Veeraops
Copy link
Author

Veeraops commented Oct 17, 2023

@sampila
We have configured environment variables as well. But still persisting an issue
Please let us know the best way to proceed or any specific information you may require from our end.

@sampila
Copy link
Collaborator

sampila commented Oct 17, 2023

@Veeraops

For now, we suggest you to use the UNIHTML_LICENSE instead,
The usage is like this

UNIHTML_LICENSE="full-content-of-license"

We will checks on our ends regarding the path issue.

@Veeraops
Copy link
Author

Hi @sampila
Any update please to resolve this issue ?

@sampila
Copy link
Collaborator

sampila commented Oct 18, 2023

Hi @Veeraops

Do this works fine?

UNIHTML_LICENSE="full-content-of-license"

@Veeraops
Copy link
Author

Hi @sampila

While we were able to successfully run UniDoc using Docker and add content with a single command, an issue arose when attempting to connect to the UniHTML server at "http://XX.XX.XX.XX:8080/," resulting in the error message "invalid or no license provided."
Please let us know if you need any additional information from our end.

@Veeraops
Copy link
Author

Veeraops commented Oct 30, 2023

@sampila
After modifying the sample code provided in the Git repository, we attempted to use the following code snippet:
opt := unihtml.Options{"XX.XX.XX.XX", 8080, false, ""}
err := unihtml.ConnectOptions(opt)
However, we encountered a "context deadline exceeded" error.
URL : https://github.com/unidoc/unihtml#usage
Could you please help us to resolve this issue ASAP

@Veeraops
Copy link
Author

@sampila
Could you please help us to resolve this issue ASAP

@sampila
Copy link
Collaborator

sampila commented Oct 31, 2023

Hi @Veeraops

Could you share a runnable code snippet? so we can debug this faster.
Like the html file you are trying to convert into pdf.

When looking at the error message, do you trying convert large html file?

@Veeraops
Copy link
Author

Veeraops commented Oct 31, 2023

Hi @sampila
After modifying the sample code provided in the Git repository, we attempted to use the following code snippet:
URL : https://github.com/unidoc/unihtml#usage

Issue 1:
It appears that there was an issue when attempting to connect to the UniHTML server at "http://xx.xx.xx.xx:8080/." The error message received was "invalid or no license provided."."

package main

import (
   "fmt"
   "os"

   "github.com/unidoc/unihtml"
   "github.com/unidoc/unipdf/v3/creator"
)

func main() {
   // UniHTML requires two arguments:
   // - Connection path to the unihtml-server i.e.: https://localhost:8080
   // - Input path for the file / directory to convert

   // Establish connection with the UniHTML Server.
   if err := unihtml.Connect("http://XX.XX.XX.XX:8080"); err != nil {
      fmt.Printf("Err:  Connect failed: %v\n", err)
      os.Exit(1)
   }

   // Get new PDF Creator.
   c := creator.New()

   // Read the content of the simple.html file and load it to the conversion.
   doc, err := unihtml.NewDocument("resume.html")
   if err != nil {
      fmt.Printf("Err: NewDocument failed: %v\n", err)
      os.Exit(1)
   }

   // Draw the html document file in the context of the creator.
   if err = c.Draw(doc); err != nil {
      fmt.Printf("Err: Draw failed: %v\n", err)
      os.Exit(1)
   }

   // Write the result file to PDF.
   if err = c.WriteToFile("document.pdf"); err != nil {
      fmt.Printf("Err: %v\n", err)
      os.Exit(1)
   }
}

Issue 2: Error: we encountered a "context deadline exceeded" error.

package main

import (
   "fmt"
   "os"

   "github.com/unidoc/unihtml"
   "github.com/unidoc/unipdf/v3/creator"
)

func main() {
   // UniHTML requires two arguments:
   // - Connection path to the unihtml-server i.e.: https://localhost:8080
   // - Input path for the file / directory to convert
   opt := unihtml.Options{"XX.XX.XX.XX", 8080, false, ""}
   err := unihtml.ConnectOptions(opt)
   if err != nil {
      return
   }
   // Get new PDF Creator.
   c := creator.New()

   // Read the content of the simple.html file and load it to the conversion.
   doc, err := unihtml.NewDocument("resume.html")
   if err != nil {
      fmt.Printf("Err: NewDocument failed: %v\n", err)
      os.Exit(1)
   }

   // Draw the html document file in the context of the creator.
   if err = c.Draw(doc); err != nil {
      fmt.Printf("Err: Draw failed: %v\n", err)
      os.Exit(1)
   }

   // Write the result file to PDF.
   if err = c.WriteToFile("document.pdf"); err != nil {
      fmt.Printf("Err: %v\n", err)
      os.Exit(1)
   }
}

Before attempting to convert a large HTML file, we are currently facing a connection issue with the UniHTML server.
Please let us know if you need any additional information from our end.

@Veeraops
Copy link
Author

@sampila Can you please clarify us whether UniPDF license also covers the UniHTML plugin ?

@sampila
Copy link
Collaborator

sampila commented Oct 31, 2023

Hi @Veeraops,

Looks like some network issue, seems the UniHTML docker is unreachable.

Yes the license should works with UniHTML.

and could you try to add this above the "main" function.

func init() {
  if err := license.SetLicenseKey(licenseKey, customerName); err != nil {
     panic(err)
  }
}

@Veeraops
Copy link
Author

@sampila It's working as expected. Thanks for the support

@sampila
Copy link
Collaborator

sampila commented Oct 31, 2023

@Veeraops glad to hear that, we closing this ticket for now.
You can re-open a issue if you are still having the issue regarding this.

@gunnsth gunnsth closed this as completed Nov 12, 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

3 participants