To export a PDF file that matches the size of the diagram instead of the page size, disable the page view.
1. Make sure nothing in your diagram is selected
2. In the panel on the right, deselect the Page view checkbox.
Alternatively, you can change the scale of the diagram and add a border around it by using the advanced export settings.
1. Click File > Export As > Advanced.
2. Select PDF from the Format drop-down list.
3. Change the export settings to suit your requirements, then click Export.