Re: fill out bulletins

2022-06-15 Thread Dennis Lee Bieber
On Tue, 14 Jun 2022 11:15:47 -0400, Dennis Lee Bieber
 declaimed the following:

>On Tue, 14 Jun 2022 00:41:07 +0200, jak  declaimed the
>following:
>

>>
>>https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf
>


>   In either case -- they should be manageable spending some time laying
>out the "form" in any decent word processor, and developing the suitable
>mail-merge definitions and database. Or even a decent report-writer with a
>relational database.

Note: if it is the "individual/one-letter-per-box" areas that are
making it seem so difficult for mail-merge... Don't do it that way!

Use one mail-merge field for the entire data item, use a monospace
(fixed width) font (Courier, Lucida Console, etc.), and adjust the
character spacing using the word-processor formatting operation (in Word
this is under the Font pop-up dialog, "advanced" tab). Set it to "expanded"
spacing and adjust the amount of expansion until your chosen font is spaced
properly to appear as one character per form box.

https://support.microsoft.com/en-us/office/change-the-spaces-between-text-e9b96011-1c42-45c0-ad8f-e8a6e4a33462

(On LibreOffice Writer, it is under Format/Character..., Position tab on
the dialog. At least, it is on the version I have on Debian in VirtualBox.)


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-14 Thread Avi Gross via Python-list
I wish this discussion was simplified.
It sounds to me like what is wanted is a way to PRINT a filled-out form using 
some dynamic text that fits over designated slots in the data. It is not that 
different from many other tasks where you overlay some graphics with text.
You need a decent version of the graphics with enough pixels and the right size 
using something as simple as a scanner at higher resolution OR getting someone 
to give you a template in a form you can use.
Using a ruler or other tools, map out the rectangles you are going to be 
printing text in.
Use your own algorithms to take each snippet of text you want to print and do 
wrapping and resizing of the font or whatever it takes to make it fit.
Finally, overlay the text snippets on the image.
Then PRINT it on a decent printer.
From what I hear, you seem not to need the original text anymore, but nothing 
stops your program with storing bits you will use again later and reusing them, 
or having a log of the original text used and so on.

Plan B might be to COPY your image on a ream of paper and then replace the 
paper in the printer so the next print writes on top of it. Create a template 
with just text that when printed will happen to write over the same spots.
As to what tools you can use, there are many to choose from. You asked on a 
Python list so you may want some of the Python Graphics utilities. In R, I 
might use ggplot which lets me set a background layer then draw objects above 
it at various offsets, as one of many things. 
I know many businesses do things like this all the time such as having printers 
loaded with checks to be printed, or inserting an envelope into a slot on the 
printer to have the name and address printedin the right places.

-Original Message-
From: Peter Pearson 
To: python-list@python.org
Sent: Tue, Jun 14, 2022 9:28 am
Subject: Re: fill out bulletins

On Tue, 14 Jun 2022 00:41:07 +0200, jak  wrote:
[snip]
>
> If you are interested in seeing what I called "post office bulletin"
> (English is not my language and I don't know the name, sorry), you can
> find a sample pdf (fillable) but it works badly here:
>
> https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf


Are these "post office bulletins" always PDFs?


-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-14 Thread Dennis Lee Bieber
On Tue, 14 Jun 2022 00:41:07 +0200, jak  declaimed the
following:

>If you are interested in seeing what I called "post office bulletin"
>(English is not my language and I don't know the name, sorry), you can
>find a sample pdf (fillable) but it works badly here:
>
>https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf

While I can't read Italian... But that looks suspiciously like what I'd
call a Return Receipt (one side to be filled with "your" address for
returning, and the other to be filled/signed by the person accepting the
article)
https://faq.usps.com/s/article/Return-Receipt-The-Basics#Green_Card

Or an archaic Telegram form (NOT the cloud app) -- or even an ARRL
Message form https://www.ncarrl.org/nets/mes_form.html

In either case -- they should be manageable spending some time laying
out the "form" in any decent word processor, and developing the suitable
mail-merge definitions and database. Or even a decent report-writer with a
relational database.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-14 Thread jak

Il 14/06/2022 15:28, Peter Pearson ha scritto:

On Tue, 14 Jun 2022 00:41:07 +0200, jak  wrote:
[snip]


If you are interested in seeing what I called "post office bulletin"
(English is not my language and I don't know the name, sorry), you can
find a sample pdf (fillable) but it works badly here:

https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf



Are these "post office bulletins" always PDFs?




Oh no, sadly no. these forms can be found almost exclusively in post
offices in paper form and you would need to fill them in by hand (only
with black or blue ballpoint pen). I struggled to find a pdf version of
them on the web that wasn't pre-compiled. I also tried to get a graphic
file by scanning (or photo) but I couldn't get a decent image, probably
because I don't have precise enough tools. Ask them for a copy of the
document from which they print them, I don't try because I think it's
wasted breath.
--
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-14 Thread Peter Pearson
On Tue, 14 Jun 2022 00:41:07 +0200, jak  wrote:
[snip]
>
> If you are interested in seeing what I called "post office bulletin"
> (English is not my language and I don't know the name, sorry), you can
> find a sample pdf (fillable) but it works badly here:
>
> https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf


Are these "post office bulletins" always PDFs?


-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread dn
On 14/06/2022 11.34, MRAB wrote:
> On 2022-06-13 23:41, jak wrote:
> [snip]
>>
>> If you are interested in seeing what I called "post office bulletin"
>> (English is not my language and I don't know the name, sorry), you can
>> find a sample pdf (fillable) but it works badly here:
>>
>> https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf
>>
> 
> Probably best to just call it a "form".

pygame might offer a simple way to add text to a 'form' at appropriate
x,y co-ordinates.
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread Greg Ewing

Another possibility is to use reportlab to generate a pdf.

--
Greg

--
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread MRAB

On 2022-06-13 23:41, jak wrote:
[snip]


If you are interested in seeing what I called "post office bulletin"
(English is not my language and I don't know the name, sorry), you can
find a sample pdf (fillable) but it works badly here:

https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf


Probably best to just call it a "form".
--
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread jak

Il 13/06/2022 23:58, Mats Wichmann ha scritto:

On 6/13/22 11:11, Michael F. Stemper wrote:

On 13/06/2022 08.49, jak wrote:

Hello everyone,
I would like to write a tool to compile post office bulletins because
here, unfortunately, they are still the most convenient way to interface
the public administration. I don't want to create a UI to edit the
bulletin, I will take the data from some file or database but I'd like
to print or save the bulletin to the file with all the fields filled in.
To accomplish this, I thought about creating a basic graphic (jpg?) file
with the bulletin image,


Please don't create an image. Create something that preserves
text as text, so that your recipients can (if they so desire)
search on that text, or copy/paste from your bulletin.


Absolutely agree. We're having a flood of people post code on Twitter
and LinkedIn, which don't support code markup/markdown, so they post
images.  There are several tools that make really pretty pictures... and
they're completely useless as you can't pick the code out of them. Hate
this.


Somebody suggested TeX/LaTeX. Excellent idea.



Don't know what a "post office bulletin" is, but this sounds like a
template problem ("all the fields filled in"). There are a lot of
templating engines in the Python world from string handling in the
standard library
(https://docs.python.org/3/library/string.html#template-strings) to
tools like JInja and Cheetah and a host of others.  I think there are
many of these listed on the wiki - maybe something here would suit your
needs?

https://wiki.python.org/moin/Templating



If you are interested in seeing what I called "post office bulletin"
(English is not my language and I don't know the name, sorry), you can
find a sample pdf (fillable) but it works badly here:

https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf
--
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread jak

Il 13/06/2022 19:11, Michael F. Stemper ha scritto:

On 13/06/2022 08.49, jak wrote:

Hello everyone,
I would like to write a tool to compile post office bulletins because
here, unfortunately, they are still the most convenient way to interface
the public administration. I don't want to create a UI to edit the
bulletin, I will take the data from some file or database but I'd like
to print or save the bulletin to the file with all the fields filled in.
To accomplish this, I thought about creating a basic graphic (jpg?) file
with the bulletin image,


Please don't create an image. Create something that preserves
text as text, so that your recipients can (if they so desire)
search on that text, or copy/paste from your bulletin.

Somebody suggested TeX/LaTeX. Excellent idea.



Part of the answer I gave to Stefan, moreover my goal is to get a piece
of paper to give to the post office and not a document to share (it
could contain personal data).

--
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread jak

Il 13/06/2022 16:12, Stefan Ram ha scritto:

jak  writes:

Can you direct me to a better way?


   You could use a word processors with a mail-merge feature or
   generate TeX/troff code for the bulletins.
>Of course, for Python, the library PIL/Pillow is available,
   which can read or write JPG files and has a "text" method
   to write text to images.

   I you want to print the bulletins, you could have a first
   pass where the images are printed and then reinsert the same
   sheets again to add the text in a second pass.




I made a few attempts with libreoffice, unfortunately the bulletin is
too complicated to get a good result. I also took a look at Tex/LaTeX as
you advised me. Of these I just knew that they existed and their use but
I didn't want to learn a new script just for a tool and in any case I
think I would encounter the same problems I had with the word processor.
I think I will use the PIL/Pillow librariesalso because I wanted to
dynamically calculate the size of the characters so as not to go beyond
the limits of the fields to be filled in in the image. Thanks for the
tips.

--
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread Mats Wichmann
On 6/13/22 11:11, Michael F. Stemper wrote:
> On 13/06/2022 08.49, jak wrote:
>> Hello everyone,
>> I would like to write a tool to compile post office bulletins because
>> here, unfortunately, they are still the most convenient way to interface
>> the public administration. I don't want to create a UI to edit the
>> bulletin, I will take the data from some file or database but I'd like
>> to print or save the bulletin to the file with all the fields filled in.
>> To accomplish this, I thought about creating a basic graphic (jpg?) file
>> with the bulletin image,
> 
> Please don't create an image. Create something that preserves
> text as text, so that your recipients can (if they so desire)
> search on that text, or copy/paste from your bulletin.

Absolutely agree. We're having a flood of people post code on Twitter
and LinkedIn, which don't support code markup/markdown, so they post
images.  There are several tools that make really pretty pictures... and
they're completely useless as you can't pick the code out of them. Hate
this.

> Somebody suggested TeX/LaTeX. Excellent idea.
> 

Don't know what a "post office bulletin" is, but this sounds like a
template problem ("all the fields filled in"). There are a lot of
templating engines in the Python world from string handling in the
standard library
(https://docs.python.org/3/library/string.html#template-strings) to
tools like JInja and Cheetah and a host of others.  I think there are
many of these listed on the wiki - maybe something here would suit your
needs?

https://wiki.python.org/moin/Templating

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-13 Thread Michael F. Stemper

On 13/06/2022 08.49, jak wrote:

Hello everyone,
I would like to write a tool to compile post office bulletins because
here, unfortunately, they are still the most convenient way to interface
the public administration. I don't want to create a UI to edit the
bulletin, I will take the data from some file or database but I'd like
to print or save the bulletin to the file with all the fields filled in.
To accomplish this, I thought about creating a basic graphic (jpg?) file
with the bulletin image,


Please don't create an image. Create something that preserves
text as text, so that your recipients can (if they so desire)
search on that text, or copy/paste from your bulletin.

Somebody suggested TeX/LaTeX. Excellent idea.

--
Michael F. Stemper
A preposition is something you should never end a sentence with.
--
https://mail.python.org/mailman/listinfo/python-list


fill out bulletins

2022-06-13 Thread jak

Hello everyone,
I would like to write a tool to compile post office bulletins because
here, unfortunately, they are still the most convenient way to interface
the public administration. I don't want to create a UI to edit the
bulletin, I will take the data from some file or database but I'd like
to print or save the bulletin to the file with all the fields filled in.
To accomplish this, I thought about creating a basic graphic (jpg?) file
with the bulletin image, filling in the fields and then saving it in a
new file.
Can you direct me to a better way? And also, direct me to a library that 
allows me to accomplish this easily?


Thank you in advance.
--
https://mail.python.org/mailman/listinfo/python-list