pywkhtmltopdf [Was: [mezzanine-users] Re: Images in .pdf Invoice]

47 views
Skip to first unread message

Mike Dewhirst

unread,
Jun 29, 2016, 1:21:18 AM6/29/16
to Django users
Sorry for hijacking a thread from Mezzanine ...

On 29/06/2016 11:22 AM, Sam Kingston wrote:
> I'm not sure if this will help you or not, but I developed a replacement
> library for xhtml2pdf (though not a drop-in):
>
> https://github.com/sjkingo/pywkhtmltopdf

Thank you Sam :)

Do you have a separate users list for questions?

In case not, I'm trying to display a page produced with function-based
views. Is there a hint you can offer?

I want the "View on site" button to produce pdf.

Maybe the real question is how do I change from function based views to
class based views - which BTW I don't want to do.

Thanks

Mike


>
> On Friday, 24 June 2016 20:13:05 UTC+10, Joseph Mohan wrote:
>
> Any other things i'm missing with regards to getting an image into
> the .pdf invoices?
>
> Set the url to a full path
>
> Tried .png/.jpgÂ
>
> Nothing...
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mezzanine-use...@googlegroups.com
> <mailto:mezzanine-use...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Akhil Lawrence

unread,
Jun 30, 2016, 5:08:50 AM6/30/16
to Django users
To answer  how do I change from function based views to class based views,

The simplest way to do that is, 


create a view file as below:

from django.views.generic import View


class ViewName(View):

    def get(self, request, *args, **kwargs):
        <copy everything you doing inside your view for GET method>

    def post(self, request, *args, **kwargs):
        <copy everything you doing inside your view for POST method>

    <similarly do for other methods (PUT, DELETE, OPTIONS etc) if needed>


update urls.py with this view :)

Mike Dewhirst

unread,
Jul 6, 2016, 8:04:41 PM7/6/16
to django...@googlegroups.com
Akhil thank you. I'll bookmark your advice for later. At this point staying with a functional view might be less work. Next views to be written will probably be class based

Cheers
Mike
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/482367e1-4ebc-469c-b318-2dcabfcbc12b%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages