Sounds promising.
Below is an example of a PollyReport.
Each band (B) contains a list of elements (E).
For each E you can define pos=(x,y), font=(name,size), text, key, align, 
width (among other parameters).
Note that an element's x,y is relative to the containing band's x,y (top 
left corner).
So maybe use a texpos box around a table with one row and try to get 
relative positions that way. 
Note: 72dpi, so x=600 is 8.33 inches from the left edge of the band

H = ("Helvetica", 10)
HB = ("Helvetica-Bold", 10)
E = PR.Element
B = PR.Band
Rule = PR.Rule # horizontal line
R = "right"

rep = PR.Report(rr)
rep.titleband = B([ E((600, 0), ("Times-Bold", 20), "Picklist"),
  E((36,30), H, f"Ship to\n{soi[4]} {soi[5]}\n{adr}"), E((380,30), H, now), 
# soi = sales order query results
  E((480,30), H, f"Order\n{so}"), E((560,30), H, f"Doc.Date\n{dd}"), 
E((630,30), H, f"Allow partial\n{soi[2]}"),
  E((480,60), H, f"MoT: {soi[7]}\nRemarks: {soi[3]}"),
])
rep.groupheaders = [ B([ Rule((36,0),650),], getvalue = lambda x: x[0] ), ]
rep.pageheader = B([
  Rule((36,0),650),
  E((90,0), H, "Item Number"), E((166,0), H, "Description"), E((410,0), HB, 
"Pick Qty", align=R),
  E((450,0), H, "UoM"), E((538,0), H, "Bin Location", align=R), E((626,0), 
H, "OnHand", align=R),
  E((680,0), H, "Picked", align=R),
  Rule((36,12),650),
])
rep.pagefooter = B([ E((72*7, 0), H, sysvar = "pagenumber", format = lambda 
x: f"[{now}]  Order {so} page {x}"), ])
rep.detailband = B([ E((52,0), H, getvalue=lambda r: r[1]+1, align=R),
  E((90,0), H, key=2), E((166,0), H, key=8), E((410,0), HB, key=6, align=R),
  E((450,0), H, key=9), E((573,0), H, key=11, width=42),
  ]
)

Regards,
Denes
On Monday, November 2, 2020 at 4:01:16 AM UTC-5 Clemens wrote:

> Hi, you can realize absolute positioning by the TeX package texpos 
> <https://ctan.org/pkg/textpos>. But I don't know PollyReports very well, 
> I only heard of it. Thus, do you have an example PDF on what you want to 
> generate?
>
> Regards
> Clemens
>
> On Monday, November 2, 2020 at 12:51:40 AM UTC+1 DenesL wrote:
>
>> Hi Clemens
>>
>> does TeX, or any of other formats supported by LyX, store the position on 
>> the page (x,y), formatting (e.g. font type and size), alignment or other 
>> valuable information about text elements that could be used to generate 
>> PollyReports Elements & Bands ?
>>
>> Regards,
>> Denes
>>
>> On Sunday, November 1, 2020 at 7:52:56 AM UTC-5 Clemens wrote:
>>
>>> Hi, you're right, I'm generate everything, because I need this in my 
>>> case. BUT: You can use LyX <https://en.wikipedia.org/wiki/LyX>as 
>>> WYSIWYG editor generating the TeX file (pure text). Then just find and 
>>> replace the things you want to adapt (e.g. date). This should be easy. If 
>>> you want to evaluate this way and you need some more assistance, please let 
>>> me know.
>>>
>>> Best regards
>>> Clemens
>>>
>>> On Saturday, October 31, 2020 at 11:29:53 PM UTC+1 DenesL wrote:
>>>
>>>> @roger: you are welcome.
>>>> @villas: probably reportlab.
>>>> @ramos: reportbro is open-source license for non-commercial open-source 
>>>> or personal projects only.
>>>> @clemens: interesting but you probably have to handle everything e.g. 
>>>> page breaks, page headers, etc. , right?.
>>>>
>>>> My need was to generate PDF documents (e.g. invoices) with report 
>>>> headers/footers, page headers/footers, detail lines, and even sub-reports 
>>>> from database queries without having to handle all the intricacies (e.g. 
>>>> page breaks, total, page numbers, etc.) and PollyReports fit the bill in a 
>>>> small and easy to use package.
>>>>
>>>> What is missing is a WYSIWYG page designer to simplify the layout 
>>>> creation. 
>>>> As an alternative I have been looking for a way to convert a template 
>>>> created by some open source program such as OpenOffice, FreeOffice,  or 
>>>> LibreOffice to the bands/elements used in PollyReports but without much 
>>>> luck so far.
>>>>
>>>> Regards,
>>>> Denes
>>>>
>>>> On Tuesday, October 6, 2020 at 11:16:18 AM UTC-4 Clemens wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> my fav is just to write a TeX file by Python and then trigger LaTeX to 
>>>>> produce the PDF document. I'm using this solution since 2 years after I 
>>>>> was 
>>>>> really frustrated by the Python PDF packages available. LaTeX gives you 
>>>>> all 
>>>>> freedom to produces a PDF document, it's perfectly documented (finding a 
>>>>> solution for every problem), it's absolutely stable, it can be expanded 
>>>>> by 
>>>>> packages, you have things like a table of contents ... Long story 
>>>>> short: I like it!
>>>>>
>>>>> Regards
>>>>> Clemens
>>>>>
>>>>> On Thursday, October 1, 2020 at 4:58:39 PM UTC+2 DenesL wrote:
>>>>>
>>>>>>
>>>>>> While searching for a Python PDF package I found PollyReports and was 
>>>>>> pleasantly surprised by it, and it is also nicely documented.
>>>>>>
>>>>>> PollyReports is a small, light module providing a simple way to 
>>>>>> generate reports from databases using Python.
>>>>>>
>>>>>> Reference: https://pythonhosted.org/PollyReports/docs.html
>>>>>> Tutorial: https://pythonhosted.org/PollyReports/tutorial.html
>>>>>> Other features (subreports): https://opensource.gonnerman.org/?cat=4
>>>>>>
>>>>>> I hope you find it as useful as I did.
>>>>>>
>>>>>> Regards,
>>>>>> Denes
>>>>>>
>>>>>>
>>>>>>
>>>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8109ca2e-7351-43cd-850e-1f63ea942a09n%40googlegroups.com.

Reply via email to