'How to generate certificate from user data on firebase database

I'm working on an online course selling app, and there I need to develop an automatic certificate generator with student names and course names. How can I integrate that? and I saw some websites for certificate generating, can I integrate that in Flutter app?



Solution 1:[1]

I'm assuming you want to design the certificate yourself. There are a couple of ways you can do that like creating it using widgets or using an image. If you use an image, you'll have to layer the user's info on top, which can be tricky to position correctly. Personally, I would probably generate the certificate using widgets and a package like this to create the image from that.

Solution 2:[2]

You can use utils::strcapture:

text_for_column_width = "category    variable   description      value      sth"
pattern <- "^(\\S+\\s+)(\\S+\\s+)(\\S+\\s+)(\\S+\\s*)"
result <- utils::strcapture(pattern, text_for_column_width, list(f1 = character(), f2 = character(), f3 = character(), f4 = character()))
nchar(as.character(as.vector(result[1,])))
## => [1] 12 11 17 11

See the regex demo. The ^(\S+\s+)(\S+\s+)(\S+\s+)(\S+\s*) matches

  • ^ - start of string
  • (\S+\s+) - Group 1: one or more non-whitespace chars and then one or more whitespaces
  • (\S+\s+) - Group 2: one or more non-whitespace chars and then one or more whitespaces
  • (\S+\s+) - Group 3: one or more non-whitespace chars and then one or more whitespaces
  • (\S+\s*) - Group 4: one or more non-whitespace chars and then zero or more whitespaces

Solution 3:[3]

You can also use this pattern:

stringr::str_split("category    variable   description      value      sth", "\\s+") %>%
unlist() %>%
purrr::map_int(nchar)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zeke Willams
Solution 2 Wiktor Stribiżew
Solution 3 Alvaro Morales