Skip to content

Commit

Permalink
refactor: update ExportPanel.vue to include generateDocumentOutline o…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
purocean committed Oct 9, 2024
1 parent 1678bf0 commit e5e9559
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/renderer/components/ExportPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
</label>
</div>
<div style="margin: 10px 0"><label><input type="checkbox" v-model="convert.pdfOptions.printBackground"> {{$t('export-panel.pdf.include-bg')}}</label></div>

<!-- generateDocumentOutline only works in headless mode https://github.com/MicrosoftEdge/WebView2Feedback/issues/4466 -->
<!-- <div style="margin: 10px 0"><label><input type="checkbox" v-model="convert.pdfOptions.generateDocumentOutline"> {{$t('export-panel.pdf.generate-document-outline')}}</label></div> -->
</div>
<div v-else> {{$t('export-panel.pdf.use-browser')}} </div>
</template>
Expand Down Expand Up @@ -118,6 +121,7 @@ export default defineComponent({
pageSize: 'A4' as 'A4' | 'A3' | 'A5' | 'Legal' | 'Letter' | 'Tabloid',
scaleFactor: 100,
printBackground: true,
generateDocumentOutline: true,
}
})
Expand Down Expand Up @@ -151,13 +155,14 @@ export default defineComponent({
// in browser, use print api
await printCurrentDocument()
} else {
const { landscape, pageSize, scaleFactor, printBackground } = convert.pdfOptions
convert.pdfOptions.scaleFactor = Math.min(200, Math.max(10, convert.pdfOptions.scaleFactor))
const { landscape, pageSize, scaleFactor, printBackground, generateDocumentOutline } = convert.pdfOptions
const buffer = await printCurrentDocumentToPDF({
pageSize,
printBackground,
generateDocumentOutline,
landscape: Boolean(landscape),
scale: scaleFactor / 100,
})
Expand Down
1 change: 1 addition & 0 deletions src/share/i18n/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ const data = {
'zoom': 'Zoom',
'use-browser': 'The browser printing feature will be used.',
'include-bg': 'Include background',
'generate-document-outline': 'Generate document outline',
},
'use-html': 'Use the rendered HTML source',
'use-markdown': 'Use markdown source',
Expand Down
1 change: 1 addition & 0 deletions src/share/i18n/languages/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ const data: BaseLanguage = {
'zoom': 'Увеличение',
'use-browser': 'Будет использоваться функция печати через браузер.',
'include-bg': 'Включить фон',
'generate-document-outline': 'Создать конспект документа',
},
'use-html': 'Использовать отображаемый HTML',
'use-markdown': 'Использовать исходный код разметки',
Expand Down
1 change: 1 addition & 0 deletions src/share/i18n/languages/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ const data: BaseLanguage = {
'zoom': '缩放',
'use-browser': '将使用浏览器打印功能',
'include-bg': '包含背景',
'generate-document-outline': '生成文档大纲',
},
'use-html': '使用渲染后的 HTML 转换',
'use-markdown': '使用 Markdown 转换',
Expand Down
1 change: 1 addition & 0 deletions src/share/i18n/languages/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ const data: BaseLanguage = {
'zoom': '縮放',
'use-browser': '將使用瀏覽器打印功能',
'include-bg': '包含背景',
'generate-document-outline': '生成文檔大綱',
},
'use-html': '使用渲染後的 HTML 轉換',
'use-markdown': '使用 Markdown 轉換',
Expand Down

0 comments on commit e5e9559

Please sign in to comment.