PDF styling - unable to remove unwanted padding

What I want to do

  • Remove unwanted spacing between internal/external link previews in PDF output.

e.g.
![[some page#my text]]

A screenshot to illustrate:

This large spacing doesn’t show in Obsidian, only in PDF exports.

Things I have tried

I have looked at the help docs (F1), but couldn’t find anything pertinent to this.

I’ve used inspect element to identify the tags, and modified them with css snippets. I’m able to make any changes I desire to show in obsidian using this method.

However, the changes are often not reflected when exporting to PDF.

I know that you can specifically modify css for PDF exports with

@media print {		
}

But how do I know the specific names of classes I’m looking to modify, given that there isn’t a default css file?

I’m probably going wrong somewhere - any thoughts appreciated!

There are a few tips over here: How to style the PDF with @media print?

As far as I understand, if you’ve found the selectors, you only need to target them inside the media print environment (in case you don’t know how to do that, this is a good place to start: Getting comfortable with Obsidian CSS).

1 Like

Unfortunately, as I perhaps poorly articulated above, that is not my experience. For I can make one change that reflects inside the app, but which does not appear to reflect on the exported PDF even if I place the same code inside of @media print.

This question has been asked many times, unfortunately without real profound answers. Some few are here:

In my Clean Embeds without cssclass, I have managed halfways, but left/right margins are still not correct in the PDF export.

I wonder if that has something to do with the different page size, maybe they use some other CSS for printing that overrides ours.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.