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

Input elements not printing #328

Closed
Schille opened this issue Jun 27, 2016 · 6 comments

Comments

@Schille
Copy link

commented Jun 27, 2016

Am I doing something wrong or is the visual output of input elements not supported?
I have a minimal HTML document with just one input (and no CSS) like so:
[...]
<input type="text" value="Foo">
[...]
Unfortunately, the output is blank. Same thing for type="radio" and so on.
I couldn't find any documentation about this, so I will be glad if anybody can give me a hint.

@liZe

This comment has been minimized.

Copy link
Member

commented Jun 27, 2016

There's a bug open (#61) to support form fields in PDF files.

If you only want to draw input tags, you just have to add some CSS as you do for other tags. There's no default CSS in WeasyPrint for forms, that's why they are not drawn (just as an empty div or span would be).

<style>input:before{content:attr(value)}</style>
<input style="background: red" type="text" value="Foo">

@liZe liZe closed this Jun 27, 2016

@obonyojimmy

This comment has been minimized.

Copy link

commented Mar 30, 2019

Here a simple solution for checkbox input :

input[type="checkbox"] {
  height: 1em;
  width: 1em;
  display: inline-block;
  border: black 2px solid;
  margin: 0 0.5em;
}
@notanumber

This comment has been minimized.

Copy link

commented Aug 23, 2019

Is this documented somewhere? I just spend several days banging my head against the wall trying to debug my document output, unable to figure out why the form values weren't being displayed. I thought I was going crazy.

@liZe

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

Is this documented somewhere? I just spend several days banging my head against the wall trying to debug my document output, unable to figure out why the form values weren't being displayed. I thought I was going crazy.

It's not documented yet, and I'm sorry for that.

I should add a stylesheet somewhere in the documentation to explain how to render forms in WeasyPrint.

liZe added a commit that referenced this issue Sep 5, 2019
Add CSS sample for forms
Related to #328.
@liZe

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

@notanumber You'll now find a sample in the documentation, I hope that it will be useful for everybody!

@notanumber

This comment has been minimized.

Copy link

commented Sep 5, 2019

@liZe thanks for the update, and apologies if my comment sounded rude. This library is great and much easier to work with then any other Python based HTML to PDF library I've tried in the past!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.