Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Mon, Feb 25, 2013 at 1:37 AM, Nick Apostolakis  wrote:
> On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee  wrote:
>>>
>>> Django docs (pretty turse):
>>> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/
>>>
>>>  From ReportLab site:
>>> http://www.reportlab.com/software/documentation/
>>>
>>> Here's a decent quick tutorial:
>>>
>>> http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/
>>>
>>> Note that what you are proposing is to create an HTML version of the
>>> report
>>> and a separate PDF version using ReportLab. Otherwise, if you want to
>>> make
>>> what would be an HTML report download as a PDF document, use @Mike's
>>> solution.
>>>
>>> Good Luck,
>>>
>>
>>
> Indeed Mark's solution is more elegant than mine if you want to use the same
> view as both html or pdf depending on a switch.

In that way the pdf is dependent on the browser, but i want browser
independent output.

> My solution creates two independend views with the same arguments, one of
> them produces always html, and the other pdf. I wanted it that way since
> these two views are aesthetically different.

I also followed this procedure of two independent views of same
argument, that's why i am looking for some easy way out.

> Depending on your design, choose the one most comfortable.
>
>
> --
>  --
>Nick Apostolakis
>   e-mail: nicka...@oncrete.gr
>  Web Site: http://nick.oncrete.gr
>  --
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Nick Apostolakis

On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee  wrote:

Django docs (pretty turse):
https://docs.djangoproject.com/en/dev/howto/outputting-pdf/

 From ReportLab site:
http://www.reportlab.com/software/documentation/

Here's a decent quick tutorial:
http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/

Note that what you are proposing is to create an HTML version of the report
and a separate PDF version using ReportLab. Otherwise, if you want to make
what would be an HTML report download as a PDF document, use @Mike's
solution.

Good Luck,
 


Indeed Mark's solution is more elegant than mine if you want to use the 
same view as both html or pdf depending on a switch.
My solution creates two independend views with the same arguments, one 
of them produces always html, and the other pdf. I wanted it that way 
since these two views are aesthetically different.

Depending on your design, choose the one most comfortable.

--
 --
   Nick Apostolakis
  e-mail: nicka...@oncrete.gr
 Web Site: http://nick.oncrete.gr
 --


--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee  wrote:
> Django docs (pretty turse):
> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/
>
> From ReportLab site:
> http://www.reportlab.com/software/documentation/
>
> Here's a decent quick tutorial:
> http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/
>
> Note that what you are proposing is to create an HTML version of the report
> and a separate PDF version using ReportLab. Otherwise, if you want to make
> what would be an HTML report download as a PDF document, use @Mike's
> solution.
>
> Good Luck,
Thanks.
>
> Mark
>
>
> On Sun, Feb 24, 2013 at 8:04 AM, Satinderpal Singh
>  wrote:
>>
>> On Sun, Feb 24, 2013 at 8:00 PM, Nick Apostolakis 
>> wrote:
>> > On 24/02/2013 03:15 μμ, Satinderpal Singh wrote:
>> >>
>> >> Thanks a lot to all. I noted your suggestions, and will try to
>> >> implement one which would be best suit to my requirement.
>> >>
>> >> By the way, i am trying to take pdf output from the models and for
>> >> that i required these libraries. Currently, i am using pisa for saving
>> >> the output of the report as pdf file.
>> >>
>> >> Basically i need both outputs, html and pdf, for my clients. I need to
>> >>   produce more than 40 different reports as html and pdf so that my
>> >> client can take whatever he needed. And if i tried to produce both
>> >> html and pdf from views, then it requires functions double to the
>> >> reports, two for each html and pdf. So, i need solution which can
>> >> convert my html output to the pdf from browser.
>> >>
>> >>
>> >>
>> >
>> > Hi there, I use the report lab library in my application to produce pdf
>> > reports.
>> >
>> > The user sees the report in html of course and has an option to download
>> > it
>> > as csv or as pdf.
>> > The pdf part is accomplished with reportlab library.
>> >
>> That exactly i want, please tell me how will i do this.
>>
>>
>> > Cheers
>> >
>> > --
>> >  --
>> >Nick Apostolakis
>> >   e-mail: nicka...@oncrete.gr
>> >  Web Site: http://nick.oncrete.gr
>> >  --
>> >
>> >
>> >
>> > --
>> > 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+unsubscr...@googlegroups.com.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/django-users?hl=en.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>>
>>
>> --
>> Satinderpal Singh
>> http://satindergoraya.blogspot.in/
>> http://satindergoraya91.blogspot.in/
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Mark Furbee
Django docs (pretty turse):
https://docs.djangoproject.com/en/dev/howto/outputting-pdf/

>From ReportLab site:
http://www.reportlab.com/software/documentation/

Here's a decent quick tutorial:
http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/

Note that what you are proposing is to create an HTML version of the report
and a separate PDF version using ReportLab. Otherwise, if you want to make
what would be an HTML report download as a PDF document, use @Mike's
solution.

Good Luck,

Mark


On Sun, Feb 24, 2013 at 8:04 AM, Satinderpal Singh <
satinder.goray...@gmail.com> wrote:

> On Sun, Feb 24, 2013 at 8:00 PM, Nick Apostolakis 
> wrote:
> > On 24/02/2013 03:15 μμ, Satinderpal Singh wrote:
> >>
> >> Thanks a lot to all. I noted your suggestions, and will try to
> >> implement one which would be best suit to my requirement.
> >>
> >> By the way, i am trying to take pdf output from the models and for
> >> that i required these libraries. Currently, i am using pisa for saving
> >> the output of the report as pdf file.
> >>
> >> Basically i need both outputs, html and pdf, for my clients. I need to
> >>   produce more than 40 different reports as html and pdf so that my
> >> client can take whatever he needed. And if i tried to produce both
> >> html and pdf from views, then it requires functions double to the
> >> reports, two for each html and pdf. So, i need solution which can
> >> convert my html output to the pdf from browser.
> >>
> >>
> >>
> >
> > Hi there, I use the report lab library in my application to produce pdf
> > reports.
> >
> > The user sees the report in html of course and has an option to download
> it
> > as csv or as pdf.
> > The pdf part is accomplished with reportlab library.
> >
> That exactly i want, please tell me how will i do this.
>
>
> > Cheers
> >
> > --
> >  --
> >Nick Apostolakis
> >   e-mail: nicka...@oncrete.gr
> >  Web Site: http://nick.oncrete.gr
> >  --
> >
> >
> >
> > --
> > 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+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
>
> --
> Satinderpal Singh
> http://satindergoraya.blogspot.in/
> http://satindergoraya91.blogspot.in/
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Sun, Feb 24, 2013 at 8:00 PM, Nick Apostolakis  wrote:
> On 24/02/2013 03:15 μμ, Satinderpal Singh wrote:
>>
>> Thanks a lot to all. I noted your suggestions, and will try to
>> implement one which would be best suit to my requirement.
>>
>> By the way, i am trying to take pdf output from the models and for
>> that i required these libraries. Currently, i am using pisa for saving
>> the output of the report as pdf file.
>>
>> Basically i need both outputs, html and pdf, for my clients. I need to
>>   produce more than 40 different reports as html and pdf so that my
>> client can take whatever he needed. And if i tried to produce both
>> html and pdf from views, then it requires functions double to the
>> reports, two for each html and pdf. So, i need solution which can
>> convert my html output to the pdf from browser.
>>
>>
>>
>
> Hi there, I use the report lab library in my application to produce pdf
> reports.
>
> The user sees the report in html of course and has an option to download it
> as csv or as pdf.
> The pdf part is accomplished with reportlab library.
>
That exactly i want, please tell me how will i do this.


> Cheers
>
> --
>  --
>Nick Apostolakis
>   e-mail: nicka...@oncrete.gr
>  Web Site: http://nick.oncrete.gr
>  --
>
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Mark Furbee
Mike DeWitt's answer is most appropriate. In you view define an argument
'pdf=False' and when returning the response from uou view, if pdf is False,
return regular HttpResponse. If pdf is True, follw @Mike's reply to set
response Content type to PDF. It is really easy to return what would be an
html response as a pdf download. You could even show report as html, with
link to download as PDF. The PDF link would go to the same view method with
'pdf=True'.
On Feb 24, 2013 6:30 AM, "Nick Apostolakis"  wrote:

> On 24/02/2013 03:15 μμ, Satinderpal Singh wrote:
>
>> Thanks a lot to all. I noted your suggestions, and will try to
>> implement one which would be best suit to my requirement.
>>
>> By the way, i am trying to take pdf output from the models and for
>> that i required these libraries. Currently, i am using pisa for saving
>> the output of the report as pdf file.
>>
>> Basically i need both outputs, html and pdf, for my clients. I need to
>>   produce more than 40 different reports as html and pdf so that my
>> client can take whatever he needed. And if i tried to produce both
>> html and pdf from views, then it requires functions double to the
>> reports, two for each html and pdf. So, i need solution which can
>> convert my html output to the pdf from browser.
>>
>>
>>
>>
> Hi there, I use the report lab library in my application to produce pdf
> reports.
>
> The user sees the report in html of course and has an option to download
> it as csv or as pdf.
> The pdf part is accomplished with reportlab library.
>
> Cheers
>
> --
>  --**--**--
>Nick Apostolakis
>   e-mail: nicka...@oncrete.gr
>  Web Site: http://nick.oncrete.gr
>  --**--**--
>
>
> --
> 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+unsubscribe@**googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at 
> http://groups.google.com/**group/django-users?hl=en
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Nick Apostolakis

On 24/02/2013 03:15 μμ, Satinderpal Singh wrote:

Thanks a lot to all. I noted your suggestions, and will try to
implement one which would be best suit to my requirement.

By the way, i am trying to take pdf output from the models and for
that i required these libraries. Currently, i am using pisa for saving
the output of the report as pdf file.

Basically i need both outputs, html and pdf, for my clients. I need to
  produce more than 40 different reports as html and pdf so that my
client can take whatever he needed. And if i tried to produce both
html and pdf from views, then it requires functions double to the
reports, two for each html and pdf. So, i need solution which can
convert my html output to the pdf from browser.


   
Hi there, I use the report lab library in my application to produce pdf 
reports.


The user sees the report in html of course and has an option to download 
it as csv or as pdf.

The pdf part is accomplished with reportlab library.

Cheers

--
 --
   Nick Apostolakis
  e-mail: nicka...@oncrete.gr
 Web Site: http://nick.oncrete.gr
 --


--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Russell Keith-Magee
On Sun, Feb 24, 2013 at 11:12 AM, Evan Brumley wrote:

> Have a look at wkhtmltopdf for easy server side generation of PDFs. It's
> not perfect, but it seems to be the best option out there at the moment.
> I'm also hearing good things about PhantomJS, though I haven't tried it out
> myself. Both options are essentially headless versions of Webkit - they
> produce results that look more or less exactly the same as a web browser,
> though it usually requires a fair bit of tweaking to get the proportions
> and pagebreaks right. Support for javascript and SVG is very good, though
> support for Flash isn't really there. They're not integrated into Django in
> any way - you need to generate local html files in a temporary location and
> run them using popen or similar.
>
> wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/
> PhantomJS: http://phantomjs.org/
>

Two other options that are worth looking into:

 * Weasyprint - An ACID2 compliant engine for converting HTML + CSS to a
PDF. It's got a painful dependency chain to install, and it's got some bugs
(e.g., table layouts can be a bit unpredictable), but for certain cases, it
works well.

 * PrinceXML. Very expensive, commercially supported option.


> Probably best to ignore the Django docs on this subject, incidentally.
> Reportlab is great but massively time consuming, and the other options
> listed in there are either dead projects or don't really do a good enough
> job.


I don't know if that's entirely fair. Native ReportLab (especially when
using the Platypus API) can be very useful for programatically generating
PDFs.

Activity on xhtmltopdf has certainly slowed, but I don't know if I'd reject
it outright. It only supports a limited number of CSS directives (e.g.,
there's on support for `float` box layouts), but inside the scope of what
it supports, it works quite well.

Yours,
Russ Magee %-)

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-23 Thread Evan Brumley
Have a look at wkhtmltopdf for easy server side generation of PDFs. It's 
not perfect, but it seems to be the best option out there at the moment. 
I'm also hearing good things about PhantomJS, though I haven't tried it out 
myself. Both options are essentially headless versions of Webkit - they 
produce results that look more or less exactly the same as a web browser, 
though it usually requires a fair bit of tweaking to get the proportions 
and pagebreaks right. Support for javascript and SVG is very good, though 
support for Flash isn't really there. They're not integrated into Django in 
any way - you need to generate local html files in a temporary location and 
run them using popen or similar.

wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/
PhantomJS: http://phantomjs.org/

Probably best to ignore the Django docs on this subject, incidentally. 
Reportlab is great but massively time consuming, and the other options 
listed in there are either dead projects or don't really do a good enough 
job.

On Sunday, February 24, 2013 4:04:07 AM UTC+11, Satinderpal Singh wrote:
>
> How do i save the output from the browser as pdf. Is there any tool 
> availabel with the django which can save the browser output to as pdf 
> file. 
>
> -- 
> Satinderpal Singh 
> http://satindergoraya.blogspot.in/ 
> http://satindergoraya91.blogspot.in/ 
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-23 Thread Mike Dewhirst

On 24/02/2013 4:04am, Satinderpal Singh wrote:

How do i save the output from the browser as pdf. Is there any tool
availabel with the django which can save the browser output to as pdf
file.



Chrome can save output as pdf all by itself. Other browsers (with 
plugins) might be able to do that as well.


But here is what you probably want ...

https://docs.djangoproject.com/en/1.4/howto/outputting-pdf/

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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.