claudep / swiss-qr-bill

A Python library to generate Swiss QR-bill payment slips
MIT License
98 stars 39 forks source link

Add a font factor parameter #55

Closed claudep closed 3 years ago

claudep commented 3 years ago

In certain cases, the font sizes may be judged a bit too small or too large. Adding a font-factor parameter could allow the user to specify a custom scaling factor for fonts.

AntonMezger commented 3 years ago

Good idea, looking forward to it. The definition of 1pt is defined as .3527 mm.

noem6942 commented 2 years ago

Just a question / remark not directly related to the core functionality. Would be nice to have a method that creates a valid CF from any number. I haven't found any solid algorithm so fare. So I ended up with this one which is very "clumsy":

def check_reference_number(reference_number):
    if reference_number.strip()[:2].upper() == "RF":
            if iso11649.is_valid(reference_number):
                ref_type = 'SCOR'
                rf = iso11649.validate(reference_number)
                return True
    return False          

customer = 100
invoice_nr = 10099
customer_invoice_nr = '%s%s' % (str(customer).zfill(6), str(invoice_nr).zfill(10))
for i in range(1000):
    rf = 'RF%d%s' % (i, customer_invoice_nr)
    if check_reference_number(rf):
        break

print(rf)
claudep commented 2 years ago

That's a good suggestion, albeit not related with this issue. Could you please create a new ticket with this content?

noem6942 commented 2 years ago

Would be a good opportunity to learn how this works - forgot in the meantime 😂.