django-easy-pdf icon indicating copy to clipboard operation
django-easy-pdf copied to clipboard

How can add style??

Open brayan15 opened this issue 7 years ago • 16 comments

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

brayan15 avatar Oct 17 '17 21:10 brayan15

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.

aureliendebord avatar Oct 18 '17 09:10 aureliendebord

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

brayan15 avatar Oct 18 '17 14:10 brayan15

Hey Brayan, Can you paste your template code here?

aureliendebord avatar Oct 18 '17 17:10 aureliendebord

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

some content here with background
{% endblock %}

{% block extra_style %}

{% endblock %}

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

brayan15 avatar Oct 18 '17 18:10 brayan15

It will be better with background-color: red;

aureliendebord avatar Oct 19 '17 08:10 aureliendebord

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

brayan15 avatar Oct 19 '17 22:10 brayan15

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

aureliendebord avatar Oct 20 '17 08:10 aureliendebord

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?

brayan15 avatar Oct 21 '17 22:10 brayan15

Can you paste your code?

You can follow my thread about displaying images #48

aureliendebord avatar Oct 25 '17 13:10 aureliendebord

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

brayan15 avatar Oct 25 '17 16:10 brayan15

Did you try:

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

...assuming you declared a STATIC_ROOT

aureliendebord avatar Oct 25 '17 18:10 aureliendebord

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.

brayan15 avatar Oct 25 '17 18:10 brayan15

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

aureliendebord avatar Oct 25 '17 19:10 aureliendebord

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

brayan15 avatar Oct 25 '17 19:10 brayan15

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

brayan15 avatar Oct 26 '17 03:10 brayan15

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

davidfraga avatar Jan 22 '18 14:01 davidfraga