From a6e03c288a20b31fb3fd1eba7eed5007a29846f9 Mon Sep 17 00:00:00 2001 From: Sathiyaseelan Ravi Date: Tue, 29 Jul 2025 18:39:57 +0530 Subject: [PATCH] Fixed multiple examples not downloading in PDF --- src/pdf-parts-gen.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pdf-parts-gen.js b/src/pdf-parts-gen.js index 295df89..9c2850b 100644 --- a/src/pdf-parts-gen.js +++ b/src/pdf-parts-gen.js @@ -237,10 +237,18 @@ function getExamplesDef(contentTypeObj, localizedExampleLabel) { } if (contentTypeObj.examples) { let iterCount = 0; - for (const oneExample in contentTypeObj.examples) { + for (const [key, exampleObj] of Object.entries(contentTypeObj.examples)) { exampleSectionDef.push([ - { text: `${localizedExampleLabel} ${++iterCount}:`, margin: [20, 10, 0, 0], style: ['small', 'b'] }, - { text: JSON.stringify(oneExample, null, 2), margin: [40, 10, 0, 0], style: 'monoSub' }, + { + text: `${localizedExampleLabel} ${++iterCount} (${key}):`, + margin: [20, 10, 0, 0], + style: ['small', 'b'], + }, + { + text: JSON.stringify(exampleObj, null, 2), + margin: [40, 10, 0, 0], + style: 'monoSub', + }, ]); } }