elliotblackburn/mdpdf

Give an example on how to set border for API usage

dasheck0 opened this issue · 4 comments

Hi,

I just used your package for the first time and it works pretty well. After CLI usage I used it within my own code. Margin for pdfs were not set so I tried to set this as an puppeteer option. Since I worked with puppeteer before I knew that I had to set a margin object with the given margins and that's that. However it did not work. After digging in your code I found that the actual option should be border instead of margin. Would be nice to document this in your README, especially as it is different from the default puppeteer options. I saw a PR referenced in one of the issues, stating that margins, were renamed to border somewhere. This was giving me the right direction. But it was by accident that I found it and I could easily have missed it.

Thanks!

Hi @dasheck0, thanks for spotting this one. I'll see about adding that documentation, it's a good catch on the mistake and lack of docs.

No worries. It worked like a charm after setting the correct attribute. So there are worse things than incomplete documentation :D

Not having any experience from before on using puppeteer, it took me a little too long to figure out that border should be an object with top, right, bottom, left. Perhaps that could be clarified in the docs as well? :)

I've made some further improvements to the docs, and might even move to "margin" as a v4 release. We originally used border as that was what the old pdf rendering system used (before Puppeteer). Margin is a little more standard language though I think.