Pdf: Add sender address to recipient block in "Plain" design

Hi there,

I need some help with the PDF design. I’m using the “Plain” template, which I slightly modified and saved as “Custom1” for general usage.

But, I’ve got one problem which seems really hard to solve. I need the sender address (e.g. mine) in small on top of the recipient address.

Here’s an example:

It’s common practice in germany because you don’t need to print your address on the envelope, if it’s present through the envelope’s window. In this example you see it underlined above the “Einschreiben”.
And yes, this is needed because we have many customers that still require their invoices to be printed and mailed by postal service.

I tried to add my details by doing a stack within the according block, where the recipient address is put in:

"columns": [
  {
    "width": 380,
    "stack": [
      "Wieske's GmbH • Süderstr. 195 • 20537 Hamburg",
      "$clientDetails"
    ],
    "margin": [
      0,
      70,
      0,
      0
    ]
  },

But that doesn’t work as intended, because it inherits the font settings, but I need the sender address to be smaller than the rest. Additionally, the extra line gets aligned on the left most border of the letter and not where the address field is placed, so parts of the sender address are off the window of the window envelope.
Since “the rest” is generated with $clientDetails, I have no clue how to archive this. I also tried to add a new column in the code, but that is messing up the whole design because all other things slide down and off the grid.

So, it looks like this now:
Screenshot 2021-02-01 175934

Any ideas on that?

Hi,

I suggest trying to replace “$clientDetails” with the specific client fields you want to show.

You can see all the variables by clicking ‘Help’ on the custom design page.

Sounds like an idea I should check out… but, how can I use formatting there? Since the “sender address” part needs to be a smaller font than the $clientDetails part, and I was yet unable to find out how to do that.

There’s info in the docs here:

https://pdfmake.github.io/docs/0.1/document-definition-object/styling/