The way I would approach this is to start with all layers hidden, keep an index count and get the total number of layers to iterate through each of them in a loop. You could export the layer name as your document name + layer name to make it easy to match up where the figure came from.
Open file, If the document has 1 canvas, get total layer length (index count), export to PDF, hide layer 1, increment index count.
(loop through process again for each layer in the front document).
If the document has >1 canvas, loop get the total number of canvases, and run the loop for each layer of each canvas.