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

How can add style?? #49

Open
brayan15 opened this issue Oct 17, 2017 · 16 comments
Open

How can add style?? #49

brayan15 opened this issue Oct 17, 2017 · 16 comments

Comments

@brayan15
Copy link

I added some styles, but I cant' see on pdf

@aureliendebord
Copy link

aureliendebord commented Oct 18, 2017

If you are using a template to render your PDF, you have to put your styles in your template after the tag. See the doc here.

@brayan15
Copy link
Author

Hello, I did that, but I can't see some styles, for example if I added background, I can't see that background on pdf file

@aureliendebord
Copy link

Hey Brayan,
Can you paste your template code here?

@brayan15
Copy link
Author

brayan15 commented Oct 18, 2017

sure,
{% extends "easy_pdf/base.html" %}
{% block content %}

some content here with background
{% endblock %}

{% block extra_style %}

<style> #content{ background: red; width: 200px; height: 200px; } </style>

{% endblock %}

I tried with this beta code, but I never see changes on pdf

@aureliendebord
Copy link

aureliendebord commented Oct 19, 2017

It will be better with
background-color: red;

@brayan15
Copy link
Author

it's work, but some styles doesn't work for example, margin and padding

@aureliendebord
Copy link

I just have tested on my code with a margin-top and it works.
Can you paste some code?

@brayan15
Copy link
Author

How can call images on my pdf file?

That happened when I try to call images from static

Invalid block tag on line 106: 'static', expected 'endblock'. Did you forget to register or load this tag?

@aureliendebord
Copy link

aureliendebord commented Oct 25, 2017

Can you paste your code?

You can follow my thread about displaying images #48

@brayan15
Copy link
Author

brayan15 commented Oct 25, 2017

<img src="{% static "images/img.jpg" %}" alt="">

@aureliendebord
Copy link

Did you try:

template.html
<img src="images/img.jpg" />

...assuming you declared a STATIC_ROOT

@brayan15
Copy link
Author

Yeah, I declared, but with static doesn't work, but if I put that on base template, work, but if I put it inside block does't work, so I decided put on base template and worked it.

@aureliendebord
Copy link

You're lucky because I can't display images at all...

@brayan15
Copy link
Author

amm I also ran python manage.py collectstatic, maybe lack run this command.

@brayan15
Copy link
Author

Is it possible put image like background? I tried but I got an error when I did it. Ty

@davidfraga
Copy link

Brayan, how can you put on the base template? I'm trying to put a background-image but I think the url address is wrong

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