[GNC] PDF filenames for reports

Geert Janssens geert.gnucash at kobaltwit.be
Sun Jan 20 07:34:59 EST 2019


Op zondag 20 januari 2019 12:32:34 CET schreef Matthijs Kooijman:
> Hi folks,
> 
> I'm replying to this old thread, adding a bit more info for anyone
> searching for this on Google (hopefully the mailing list archive will
> add this post to the existing thread...).
> 
> > Ok, in dconf you will want to look for
> > /org/gnucash/general/report/pdf-export/(filename-format and filename-
> > date-format)
> 
> I've found these dconf values and changing them works (gnucash 2.6.15).
> 
> However, I wanted to use just the invoice number as the filename, so I
> changed the value from the default "%1$s-%2$s-%3$s" to "%2$s". Clicking
> PDF export on an invoice then crashed Gnucash, with an assertion
> failure: *** invalid %N$ use detected ***
> 
> This is because printf does not support skipping arguments (when there
> is no format string for an argument, printf has no idea how big it is on
> the stack, so it cannot tell where the next argument begins).
> 
> In this case, I found a simple workaround in the "precision" specifier
> of printf format strings. For string arguments, the precision is used as
> the maximum string width, truncating any longer strings. So you can add
> a zero-width specifier for any arguments that you want to skip. E.g. it
> works with "%1$.0s%2$s" (note that argument 3 can be left out, since it
> is at the end).
> 
> Just in case anyone else runs into this :-)
> 
> Gr.
> 
> Matthijs

Cool tip :)

Thanks!

Geert





More information about the gnucash-user mailing list