Print custom invoice without a white margin?

A couple of years ago I started this discussion about the difficulties of building custom themes, and the lack of real support for CSS. Lubos explained why broad support for CSS was dropped (essentially to keep the app download size small). A semi-work-around for Mac users is to ‘print’ the PDF using macOS’s built-in WebKit renderer, and this is what I’ve been doing. (Two years on, Manager’s internal PDF generation still lacks CSS support.)

It’s an okay workaround, but there has been one outstanding irritation—it’s impossible (for some reason) to print from Manager without a white margin being added to the invoice. I use a special PDFwriter driver that requires no margins (unlike an actual printer), and I’ve also toyed with all the print settings, but there just isn’t any way to get rid of it. So I’ve spent the last two years manually removing this margin in Acrobat before emailing invoices. (Yes, I confess, I’m a little anal about such things. It’s the designer in me.)

So @lubos, I was wondering now, is there an easy way for you to give the user control over whether a white margin gets added or not? Maybe I’m a rare case—someone who isn’t using Manager’s built-in themes and wants control over how invoices look? I figure there’s no harm in asking though. It would make my day if that annoying margin could be removed. :slight_smile:

i do not know why you are facing such problems with Manager pdf generator.
i cannot test on a mac but on Windows the Manager internal pdf generator works perfectly fine if you set the required padding in your theme.

below is my custom theme with padding set to 20px.
image

when padding set to 0px.
image

i have not used any CSS codes but only liquid codes in my theme.

I’ve had the same experience, @Kal. I’m convinced there is something in macOS (possibly left over from the dawn of time) intended to avoid problems with printers that cannot print to the edge of the paper. We all know there are things buried within operating systems with ancient origins.

Ultimately, I had to duplicate my custom theme with smaller padding to obtain consistent margins when printing directly and making PDFs. I choose the theme based on whether a transaction will be converted to PDF or not. It’s nothing to do with Manager, though, because the same code is being run on all platforms.

It may irk the designer in you, but the solution is to avoid designs that bleed elements to the paper’s edge.

Hi @sharpdrivetek. The answer to your question, about why I have this problem and you don’t, is there in your last comment. Manager’s internal PDF generator simply doesn’t support CSS properly. It supports some basic stuff, but not enough to do CSS layouts. If you want to know more (and you have a spare hour or two!) have a read of that old discussion I mentioned earlier.

Thanks @Tut. That’s an interesting workaround. You have correctly guessed that my design has elements that bleed. Would my clients care (or even notice) if I lost this? Probably not. Can I bring myself to hack my beautiful theme? Ah… Hmm… :grimacing:

I’m not so sure. Here are two screenshots of the macOS print window, one from Affinity Designer and one from Manager. I have created a simple A4 page in each, with nothing but a solid blue background fill that goes right to the edges of the page…

Printing a PDF from Affinity Designer

Printing a PDF from Manager

They’re both using the macOS print engine and the same ‘PDFwriter’ print driver.

Edit: Oh, and I forgot to mention… When I looked at this originally, I did look into the possibility that margins were being added at the print stage. You can’t normally see a print driver’s margins. (You know Apple—they like to hide these frivolous details from plebs like us.) But you can see the margins if you click on the paper size and select ‘Manage Custom Sizes’. As you can see, my margins are all set to zero. (If you’re wondering about the odd paper size here, I created a special paper size to account for Manager’s extra margins, which I later remove as mentioned to return the page to A4 size.)

You overlook one important point, @Kal. Your other application substitutes its own printer interface. Manager doesn’t, so you see the default macOS interface. I assume the difference extends to other aspects of the drivers. It could hardly be otherwise.

This Apple support document says:

If you print a document and see unexpected margin sizes or clipped text, there may be a conflict between the margins set for your page size in the app and the non-printable area of the page set for your selected printer. Try setting the non-printable area for the page size to zero.

This implies that if you have your page margins set to zero in the print window (which I do), then there’s some kind of margin setting in the app that is conflicting with it. If this is true, it’s quite possible that many apps don’t make this ‘setting’ accessible to the user, no? That is my suspicion here.

I just tested a bunch of apps—some print to the edges, some don’t. So that’s not really telling us anything much. I think we need @lubos to shed some light here.

Your quote also mentions the printer driver as part of the equation. I believe that is where the problem lies.

The macOS print window allows me to set margins to zero. Manager provides no such setting. So I’m not sure why you assume it’s the print driver. That would make it a bug, whereas it may just happen to be the intended behaviour for Manager. I’ve summoned Lubos a couple of times now, so we’ll have to wait and see if he comments and can shed any light on the matter. If it turns out macOS is to blame, I will happily submit a bug report to Apple.

Because when you print from an application that substitutes its own printer driver, like Affinity or Word, it doesn’t happen. But when you print from an application that uses the default macOS printer driver, like Manager, it does.

I think you’re misunderstanding what a printer driver is. It provides lower-level communications between the computer and the printer. In my case, I’m using a driver for a virtual device, designed to create PDFs without the usual limitations of any specific printer hardware (like non-printable areas for example). In any case, a program like Affinity doesn’t ‘substitutes its own printer driver’ as you put it. It may provide its own tailored interface and settings, and I think that’s what you’re referring to.

The Apple support document which I quoted from makes very clear that you can set ‘the non-printable area for the page size to zero’. If it can’t actually do that (without some kind of hack from the app developer) then that would be a serious bug. As I said, if that can be demonstrated, I will very happily submit a bug report to Apple.

Anyway, I don’t think anything more can be gained by us speculating back and forth about what Manager is or isn’t contributing to the issue (unless you happen to have inside information from the devs which I’m not aware of.) We can only hope that they respond to the thread and enlighten us. I’m happy to be proved wrong if they do.