mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
fix: fix export pdf scale param
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
<div style="margin: 10px 0">
|
||||
<label class="row-label">
|
||||
{{$t('export-panel.pdf.zoom')}}
|
||||
<input v-model="convert.pdfOptions.scaleFactor" type="number" max="100" min="10" setp="1" style="display: inline-block;width: 4em">
|
||||
<input v-model.number="convert.pdfOptions.scaleFactor" type="number" max="200" min="10" step="1" style="display: inline-block;width: 4em">
|
||||
</label>
|
||||
</div>
|
||||
<div style="margin: 10px 0"><label><input type="checkbox" v-model="convert.pdfOptions.printBackground"> {{$t('export-panel.pdf.include-bg')}}</label></div>
|
||||
@@ -116,7 +116,7 @@ export default defineComponent({
|
||||
pdfOptions: {
|
||||
landscape: '',
|
||||
pageSize: 'A4' as 'A4' | 'A3' | 'A5' | 'Legal' | 'Letter' | 'Tabloid',
|
||||
scaleFactor: '100',
|
||||
scaleFactor: 100,
|
||||
printBackground: true,
|
||||
}
|
||||
})
|
||||
@@ -152,12 +152,14 @@ export default defineComponent({
|
||||
await printCurrentDocument()
|
||||
} else {
|
||||
const { landscape, pageSize, scaleFactor, printBackground } = convert.pdfOptions
|
||||
convert.pdfOptions.scaleFactor = Math.min(200, Math.max(10, convert.pdfOptions.scaleFactor))
|
||||
|
||||
|
||||
const buffer = await printCurrentDocumentToPDF({
|
||||
pageSize,
|
||||
printBackground,
|
||||
landscape: Boolean(landscape),
|
||||
scaleFactor: Number(scaleFactor)
|
||||
scale: scaleFactor / 100,
|
||||
})
|
||||
|
||||
downloadContent(name + '.pdf', buffer, 'application/pdf')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { VNode } from 'vue'
|
||||
import type { OpenDialogOptions } from 'electron'
|
||||
import type { OpenDialogOptions, PrintToPDFOptions } from 'electron'
|
||||
import type { Language, MsgPath } from '@share/i18n'
|
||||
import type { Doc, FileItem, PathItem, Repo } from '@share/types'
|
||||
import type MarkdownIt from 'markdown-it'
|
||||
@@ -264,12 +264,7 @@ export type SettingGroup = 'repos' | 'appearance' | 'editor' | 'image' | 'proxy'
|
||||
export type RegistryHostname = 'registry.npmjs.org' | 'registry.npmmirror.com'
|
||||
export type Keybinding = { type: 'workbench' | 'editor' | 'application', keys: string | null, command: string }
|
||||
|
||||
export type PrintOpts = {
|
||||
landscape?: boolean,
|
||||
pageSize?: 'A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid' | 'Ledger' | { height: number, width: number }
|
||||
scaleFactor?: number,
|
||||
printBackground?: boolean,
|
||||
}
|
||||
export type PrintOpts = PrintToPDFOptions
|
||||
|
||||
export type ConvertOpts = {
|
||||
fromType: 'markdown' | 'html',
|
||||
|
||||
Reference in New Issue
Block a user