You are viewing limited content. For full access, please sign in.

Question

Question

PDF image of a saved form

asked on February 13, 2024

Hi All,

Looking for some advice on achieving a high-quality forms output.

I have a heading from a single line field, there is some CSS to format as a heading but the printed output shows just as plain text.  Is there a way to apply a class that the pdf saving process will recognize?

Also, ive noted that Verdana and Tahoma fonts, while supported in the modern designer, save the output to PDF poorly.  It looks like the fonts are being substituted with a serif font so we end up with inconsistent fonts on the page.  I’ve noted arial and open sans seem to be okay. Is there a way to have all the fonts in the design pallet recognized in the PDF?

This is my CSS

#q41 input {
    color: #272822;
    background-color: #ffffff;
    font-family: 'Open Sans', Arial;
    font-size: 28px;
    font-color: #ffffff;
    padding: 50px 10px;
    border-radius: 4px;
}

 

2024-02-14_18-16-00.jpg
0 0

Answer

SELECTED ANSWER
replied on February 14, 2024 Show version history

Hi Sean,

The important thing to note is that when Forms generates a PDF, all input fields except for radio buttons and checkboxes are generated as div elements without the input field.

As a result, any CSS targeting input, textarea, or select elements will not work because the HTML content for the saved PDF is not the same.

There's a few ways to address this:

Use the Field Id for the CSS

Instead relying on the parent and element type, target the field directly. For example, if your parent element is targeted with #q41, then for anything other than a table the field id should be #Field41.

The same id is applied whether it is an input or read-only, so that should work in both scenarios.

#Field41 {
    /* your css here */
}

 

Add more CSS selectors to cover the read-only version

The HTML structures stays pretty much the same; the input is converted to a div element, but the rest is mostly left alone, so you can target the child of the div with the cf-field class.

#q41 input,
#q41 .cf-field > div {
    /* your css here */
}

Or you could just have it increase the font size of anything that is an immediate child of the div element with the cf-field class.

#q41 .cf-field > * {
    /* your css here */
}

 

Try to override the default CSS

The default font size is set by CSS classes within Forms, so you could just add the same selectors to try and override it with your own (I haven't tested this with a saved PDF yet).

#q41 input,
.fl-component .submission-view {
  /* your css here */
}

That second selector is pulled from the default Forms css and applies in read-only view, which in previous versions was mostly the same as the version used to generate a PDF.

 

One of the easiest ways to test stuff like this is to create a user task with the "read only" check box selected, then assign it to yourself to see if it does what you want.

The read-only copy for a user task should be pretty close to what is used for the PDF so you can test your CSS and stuff like that more easily.

3 0

Replies

replied on February 14, 2024 Show version history

See if changing your css to point to ".cf-field" instead of "input" will work.

The input elements don't actually exist in the read-only / archival version of the form, so your CSS doesn't get applied.

#q41 .cf-field {
    color: #272822;
    background-color: #ffffff;
    font-family: 'Open Sans', Arial;
    font-size: 28px;
    font-color: #ffffff;
    padding: 50px 10px;
    border-radius: 4px;
}

EDIT TO ADD: @████████'s answer is much more thorough and he beat me by like 6 seconds posting it - so pick his answer. wink

 

1 0
replied on February 14, 2024

Hi Matt,

I had the same thought and tried this one too, but I couldn't get it to work.

The built-in size comes from the ".fl-component .submission-view" selector, which applies to the child element, so unfortunately it doesn't seem like the child field/div will inherit font size from the .cf-field parent.

1 0
replied on February 14, 2024

Oops.  That often worked in the Classic Designer, but I admit I hadn't played with it in the new designer.

0 0
replied on February 14, 2024

Yea, the new structure is slightly different so it's a bit of trial and error; I haven't played with the new designer too much either.

It's unfortunate because in most ways it is a significant improvement, but I still can't recreate any of my critical forms due to the JavaScript restrictions.

1 0
replied on February 14, 2024

Yeah, same.

0 0
replied on February 19, 2024

Thanks for these helpful responses. I'm working in the modern designer and the #Field didn't work for me. Adding the .fl-component .submission-view applied the font to all headings but targeting the field and the submission-view worked.  This screen shot is from the printed output and a copy of the css.  

#q51 input, #q51
.fl-component .submission-view  {
  background-color: #205685!important;
  color: #FFFFFF!important;
  font-size: 33px;
  font-family: 'Open Sans', sans-serif;
  font-weight: inherit;
  font-style: normal;
  text-align: center;
  height: 80px; /* Adjust the height value according to your preference */
}

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.