prettytable icon indicating copy to clipboard operation
prettytable copied to clipboard

Pagination for lp

Open GoogleCodeExporter opened this issue 9 years ago • 3 comments

What steps will reproduce the problem?
1. pipe = subprocess.os.popen('lp','w')
2. pipe.write(table.get_string())
3. pipe.close()

What is the expected output? What do you see instead?
Headers appear on first page only. It would be nice to be able to paginate for 
some number of lines per pate

What version of the product are you using? On what operating system?
0.7.2

Please provide any additional information below.
Example of code attached. There may be a need to specify columns per page as 
well.

Original issue reported on code.google.com by [email protected] on 21 Jul 2013 at 11:06

GoogleCodeExporter avatar Aug 22 '15 23:08 GoogleCodeExporter

[deleted comment]

GoogleCodeExporter avatar Aug 22 '15 23:08 GoogleCodeExporter

change required to print table with fewer lines than pagelen:

30c30,33
<     cline = eline < pagelen and 0 or cline + pagelen
---
>     if eline < pagelen:
>         cline = 0 
>     else:
>         cline += pagelen

Original comment by [email protected] on 22 Jul 2013 at 2:56

Attachments:

GoogleCodeExporter avatar Aug 22 '15 23:08 GoogleCodeExporter

Hello.  Thanks for this request, and my apologies for the extremely slow 
response time.

I have just implemented a "paginate" method in the SVN trunk which produces a 
string suitable for passing to lp (but it's up to the user to pass it to lp, I 
didn't want to put that into PrettyTable).  It looks like this:

table.paginate(page_length=58, **kwargs),

where the kwargs can be anything that you would normally pass to get_string 
(including start and end, which enable only paginating a subset of the table).

Please give the new code a test in your application and let me know if it works 
as required or not.  Sorry again for the delay.

Original comment by [email protected] on 7 Oct 2013 at 10:17

  • Changed state: Started

GoogleCodeExporter avatar Aug 22 '15 23:08 GoogleCodeExporter