[GNC] HELP! Invoice Stylesheet, how to? V4.8
Yves-Eric Martin
yem_lists.gnucash.org at filter.yve.net
Fri Jun 30 23:12:56 EDT 2023
Hi Robert,
I don't know if that will suit your workflow, but sharing what I am doing now. It's a bit convoluted, but if you are familiar with CSS, and if you only issue a handful of invoices monthly, it's not too bad.
I found that by using CSS, we can quite heavily customize the existing stylesheets. For example, you can hide elements with "display: none", move things around with "position: absolute", add new static elements with "::before { content: ...}"... See the attached screenshot for an example of what can be achieved (this is based on the Easy stylesheet).
1) Preparation (one time)
- Create a dummy invoice for a dummy customer (don't post it)
- Print the invoice with the stylesheet of your choice that will server as a base, to get a print preview tab.
- Print the invoice to HTML, open the HTML in a browser so you can inspect it and find the CSS class names you want to target for your customizations.
- In the Options, add custom CSS to customize the invoice your liking. (*)
- Save the invoice as an "Invoice" custom report configuration.
(*: this can take some time to get the details right. It took me a few hours to get to the example attached)
2) Using the report configuration
Instead of using "Print" from the invoice, what you do is:
- Open the "Saved report configurations" modal.
- Double-click the "Invoice" configuration to open it in a new tab (showing the dummy invoice).
- Click on Options and select the invoice you want to print in the Invoice ID dropdown.
- Click OK (*)
You can now print your customized invoice.
(*: on macOS, I found that clicking OK may cause GnuCash to start spinning. But clicking "Apply" then closing the modal manually works.)
I have been operating like this for a while, and with every GnuCash major upgrade, I found that the base stylesheets change a bit, causing my carefully crafted customizations to break, and I have to revisit the CSS a bit... So while this does get the job done, it is not at all what I would call a "clean" solution, it is much more of a hack, and I have been considering creating a custom stylesheet, but haven't taken the time to explore that yet.
So, if you do get your approach working, please do share how! I'd love to hear the details. It will probably be more maintainable in the long term.
PS: in case you are interested in pursuing this custom CSS approach, you can find the CSS I used for this example here: https://gist.github.com/yemartin/98fbb32d1149f9c3f429ad2480274df5
Hope this helps,
Yves-Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_2023_07_01_11_04.png
Type: image/png
Size: 61065 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20230701/f5f03d63/attachment-0001.png>
-------------- next part --------------
> On Jun 30, 2023, at 23:38, Robert Heller <heller at deepsoft.com> wrote:
>
> I had some nicely designed stylesheets for my Invoices working with V2.6, but
> with V4.8, they are (appearently) gone (well, I still have the scheme files,
> but V4.8 is not seeing them). I just created a new stylesheet using the GUI
> [Edit=>Style Sheets] (is there a programmatical way to create style sheets?
> Scheme? Python? Something else? (css?).), and the new style sheet shows up in
> the list of possible style sheets, but does not seem to work...
>
> --
> Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
> Deepwoods Software -- Custom Software Services
> http://www.deepsoft.com/ -- Linux Administration Services
> heller at deepsoft.com -- Webhosting Services
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
More information about the gnucash-user
mailing list