mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop: Add option to set page dimensions when printing (#1976)
* add setting: export.pdfPageSize * create 2 settings: size and orientation * export.pdfPageOrientation: use string instead of boolean * add other page formats supported by Electron
This commit is contained in:
parent
348c4ad3a3
commit
5f28d0ec24
@ -1213,7 +1213,7 @@ class NoteTextComponent extends React.Component {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (target === 'pdf') {
|
if (target === 'pdf') {
|
||||||
this.webviewRef_.current.wrappedInstance.printToPDF({ printBackground: true }, (error, data) => {
|
this.webviewRef_.current.wrappedInstance.printToPDF({ printBackground: true, pageSize: Setting.value('export.pdfPageSize'), landscape: Setting.value('export.pdfPageOrientation') === 'landscape' }, (error, data) => {
|
||||||
restoreSettings();
|
restoreSettings();
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -407,6 +407,23 @@ class Setting extends BaseModel {
|
|||||||
tagHeaderIsExpanded: { value: true, type: Setting.TYPE_BOOL, public: false, appTypes: ['desktop'] },
|
tagHeaderIsExpanded: { value: true, type: Setting.TYPE_BOOL, public: false, appTypes: ['desktop'] },
|
||||||
folderHeaderIsExpanded: { value: true, type: Setting.TYPE_BOOL, public: false, appTypes: ['desktop'] },
|
folderHeaderIsExpanded: { value: true, type: Setting.TYPE_BOOL, public: false, appTypes: ['desktop'] },
|
||||||
editor: { value: '', type: Setting.TYPE_STRING, subType: 'file_path_and_args', public: true, appTypes: ['cli', 'desktop'], label: () => _('Text editor command'), description: () => _('The editor command (may include arguments) that will be used to open a note. If none is provided it will try to auto-detect the default editor.') },
|
editor: { value: '', type: Setting.TYPE_STRING, subType: 'file_path_and_args', public: true, appTypes: ['cli', 'desktop'], label: () => _('Text editor command'), description: () => _('The editor command (may include arguments) that will be used to open a note. If none is provided it will try to auto-detect the default editor.') },
|
||||||
|
'export.pdfPageSize': { value: 'A4', type: Setting.TYPE_STRING, isEnum: true, public: true, appTypes: ['desktop'], label: () => _('Page size for PDF export'), options: () => {
|
||||||
|
return {
|
||||||
|
'A4': _('A4'),
|
||||||
|
'Letter': _('Letter'),
|
||||||
|
'A3': _('A3'),
|
||||||
|
'A5': _('A5'),
|
||||||
|
'Tabloid': _('Tabloid'),
|
||||||
|
'Legal': _('Legal'),
|
||||||
|
};
|
||||||
|
}},
|
||||||
|
'export.pdfPageOrientation': { value: 'portrait', type: Setting.TYPE_STRING, isEnum: true, public: true, appTypes: ['desktop'], label: () => _('Page orientation for PDF export'), options: () => {
|
||||||
|
return {
|
||||||
|
'portrait': _('Portrait'),
|
||||||
|
'landscape': _('Landscape'),
|
||||||
|
};
|
||||||
|
}},
|
||||||
|
|
||||||
|
|
||||||
'net.customCertificates': {
|
'net.customCertificates': {
|
||||||
value: '',
|
value: '',
|
||||||
|
Loading…
Reference in New Issue
Block a user