How can I create a well-structured PDF with macOS?

I'm trying to put together a text-based PDF that will be read with a screen reader. In order to make the reading process as straightforward as possible I've used a hierarchy of three levels of headings. I originally created the document in Google Drive, but if I try to export a PDF from there all my headers disappear in the PDF document. If I export from Drive to Word then the headings are retained, but they disappear when I create a PDF from Word by using the built-in macOS PDF creation function.

How can I retain my headings when I create a PDF in macOS?


In Word for Mac 2019 (Version 16.41 (20081900) if I go to File -> Save As and choose File Format PDF it displays an option, "Best for electronic distribution and accessibility (uses Microsoft online service)". It then asked permission to use the online service. When testing in macOS Preview the Table of Contents shows Heading Two and Three assuming Heading One is the title. Setting an actual title with the title style now shows the Title and the 3 headings in the PDF table of contents.

So I think this will work without needing more advanced PDF tools such as Adobe Acrobat.

You might want to produce an actual Table of Contents in Word that might help as well but it wasn't necessary. I just applied the Heading Styles in Word to the headings and made the body portions the normal style.

Also in Word there is "Check Accessibility" under the Tools menu.

Tested doing same in Pages and that produces a table of contents with the style headings as well in PDF. But Word allowed for collapsing the headings while Pages generated the headings in a linear fashion in the table of contents.