Forum Discussion

JulieMeeker's avatar
JulieMeeker
Qrew Trainee
2 years ago

Using HTML to size a QR Code from a Formula Rich Test field

I use QR Codes in almost all of my apps.  Of course I found out how to do that here!  But I can not seem to change the size for printing using exact form.  Would it be possible to add HTML formatting in that formula rich text field to the change the size of that generated code or possibly in another formula rich text field that calls the QR Code field. 

PS I am not a coder and have very little experience with HTML. 

Thanks in advance!

------------------------------
Julie Meeker
------------------------------

5 Replies

  • Just a follow on.  I have tried to create a URL to the RTF field and them use the <img src> tag, but that did not work.  I think that the RTF field needs to be converted to an image and then uploaded as a file attachment.  Is there a way to convert the RTF to an image in a formula field?

    ------------------------------
    Julie Meeker
    ------------------------------
    • AngelRodriguez's avatar
      AngelRodriguez
      Qrew Assistant Captain
      Hi Julie,

      Do you happen to have a sample of the formula you're using now so I can look at the container and/or divs you're using. 

      Thanks,
      Angel

      ------------------------------
      AR
      ------------------------------
      • JulieMeeker's avatar
        JulieMeeker
        Qrew Trainee
        Umm  I'm not really sure what container of divs really are.  Here is the code that I am using the the formula rich text field to generate the QR Code. 
        "<img src=\"http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl="&[Serial #]& "\"\"/>"


        ------------------------------
        Julie Meeker
        ------------------------------
  • FYI  I sort of figured it out!  
    "<img src=\"http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl="&[Serial #]
    & "\"\"/>"

    Originally the 300X300 was 120X120.  Adjust this number and it changes the size of the image!

    ------------------------------
    Julie Meeker
    ------------------------------
    • AngelRodriguez's avatar
      AngelRodriguez
      Qrew Assistant Captain
      I don't think you need all of the string escapes you wrote at the end of the image tag ("\"\"/).

      It would work if you wrote it like this:
      "<img src=\"chart.apis.google.com/chart?cht=qr&chs=300x300&chl=\"& [Serial #] &>"

      Although adding sizing directly to the src is not recommended, e.g. "300x300".  Here's an old school way to add width and height to the element, since we can't use stylesheets in Quickbase directly.  By the way, I wrote this with my own example since your src doesn't show up on my end.

      1. 
      "<img width='300px' height='300px' src='https://pngimg.com/uploads/qr_code/qr_code_PNG6.png'>"

      Or you can write this with the style tag via inline styling:
      2. 
      "<img style=\"width:300px; height:300px\" src='https://pngimg.com/uploads/qr_code/qr_code_PNG6.png'>"

      It's a little cleaner to add your styling either way, as shown in examples 1 and 2.  Normally, you would write your styling with a separate CSS stylesheet, but for Quickbase purposes, inline styling suffices.  Here's an example of what the formula in examples 1 and 2 render. 




      ------------------------------
      AR
      ------------------------------