Dan, thanks for your guidance. I ended up looping through the attachment property and selecting the first PDF found.
This seems to work well enough for me (I don't store more than one PDF per entry, and haven't tested whether it corresponds with the Open PDF button / double-clicking parent if you do). Do you know how doubling clicking the parent / pressing Open PDF works, and whether this aligns?
function doExport() {
var item;
while ((item = Zotero.nextItem())) {
// Zotero.debug(item);
for (let key in item.attachments) {
let attachment = item.attachments[key];
// Zotero.debug(attachment);
if (attachment.contentType === "application/pdf") {
Zotero.write("zotero://open-pdf/library/items/");
Zotero.write(attachment.key);
Zotero.write("?page=0");
break;
}
}
}
}