🎨 支持去掉 PDF 导出页脚处 由思源笔记导出 https://github.com/siyuan-note/siyuan/issues/6881

This commit is contained in:
Liang Ding 2022-12-17 12:22:18 +08:00
parent fc129c8a6a
commit 72688e25d2
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
8 changed files with 30 additions and 15 deletions

View file

@ -612,7 +612,7 @@
"max": "Max",
"md2": "Code block ligature",
"md3": "After enabling, the code block will display the ligature",
"md4": "Automatically indent the beginning of paragraphs to conform to traditional Chinese typesetting habits",
"md4": "After enabling, automatically indent the beginning of paragraphs to conform to traditional Chinese typesetting habits",
"md7": "Whether to display the network picture corner mark",
"md8": "After enabling, if the picture is a web file (non-local asset file), it will display a corner mark",
"md9": "Virtual Reference keyword inclusion list",
@ -658,9 +658,11 @@
"export15": "Label Package Symbol",
"export16": "Please fill in the symbol on the left side of the tag and the symbol on the right side of the tag in the input box in turn",
"export17": "Add document title",
"export18": "Insert document title as a heading 1 at the beginning",
"export18": "After enabling, insert the document title as a heading 1 at the beginning",
"export19": "Path to Pandoc executable",
"export20": "Exporting Word .docx files requires format conversion using <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a>",
"export21": "Export PDF with footer",
"export22": "After enabling, add <code class='fn__code'>Export by SiYuan</code> at the footer of the exported PDF",
"blockRef": "Ref Block",
"theme11": "Use theme in light mode",
"theme12": "Use theme in dark mode",

View file

@ -612,7 +612,7 @@
"max": "Maximizar",
"md2": "Ligadura de bloque de código",
"md3": "Tras la habilitación, el bloque de código mostrará la ligadura",
"md4": "Sangria automáticamente el comienzo de los párrafos para ajustarse a los hábitos tipográficos tradicionales chinos",
"md4": "Después de habilitar, sangrar automáticamente el comienzo de los párrafos para ajustarse a los hábitos de composición tipográfica chinos tradicionales",
"md7": "Mostrar la marca de esquina de la imagen de red",
"md8": "Después de habilitarlo, si la imagen es un archivo de red (archivo de activos no locales), mostrará una marca de esquina",
"md9": "Lista de inclusión de palabras clave de referencia virtual",
@ -658,9 +658,11 @@
"export15": "Símbolo del paquete de la etiqueta",
"export16": "Por favor, rellene el símbolo del lado izquierdo de la etiqueta y el símbolo del lado derecho de la etiqueta en el cuadro de entrada por turnos",
"export17": "Añadir título del documento",
"export18": "Insertar el título del documento como título 1 al principio",
"export18": "Después de habilitar, inserte el título del documento como encabezado 1 al principio",
"export19": "Ruta de acceso al ejecutable de Pandoc",
"export20": "La exportación de archivos Word .docx requiere la conversión del formato mediante <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a>",
"export21": "Exportar PDF con pie de página",
"export22": "Después de habilitar, agregue <code class='fn__code'>Exportar por SiYuan</code> al pie de página del PDF exportado",
"blockRef": "Bloque de referencia",
"theme11": "Usar tema en modo claro",
"theme12": "Usar tema en modo oscuro",

View file

@ -612,7 +612,7 @@
"max": "Max",
"md2": "Ligature du bloc de codes",
"md3": "Après l'activation, le bloc de code affichera la ligature",
"md4": "indenter automatiquement le début des paragraphes pour se conformer aux habitudes de composition traditionnelles chinoises.",
"md4": "Après l'activation, indentez automatiquement le début des paragraphes pour se conformer aux habitudes de composition chinoises traditionnelles",
"md7": "Affichage ou non de la marque d'angle de l'image réseau",
"md8": "Après l'activation, si l'image est un fichier web (fichier d'actif non local), une marque d'angle apparaîtra.",
"md9": "Liste d'inclusion de mots-clés de référence virtuelle",
@ -658,9 +658,11 @@
"export15": "Étiquette Symbole de l'emballage",
"export16": "Veuillez remplir successivement le symbole figurant à gauche de l'étiquette et le symbole figurant à droite de l'étiquette dans le champ de saisie.",
"export17": "Ajouter le titre du document",
"export18": "Insérer le titre du document comme titre de premier niveau au début",
"export18": "Après activation, insérez le titre du document comme titre 1 au début",
"export19": "Chemin vers l'exécutable Pandoc",
"export20": "L'exportation de fichiers Word .docx nécessite une conversion de format à l'aide de <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a>",
"export21": "Exporter un PDF avec pied de page",
"export22": "Après l'activation, ajoutez <code class='fn__code'>Exporter par SiYuan</code> au pied de page du PDF exporté",
"blockRef": "Bloc Réf",
"theme11": "Utiliser le thème en mode Clair",
"theme12": "Utiliser le thème en mode sombre",

View file

@ -612,7 +612,7 @@
"max": "最大化",
"md2": "代碼塊連字",
"md3": "啟用後代碼塊將顯示連字",
"md4": "自動進行段首縮進,以符合傳統中文排版習慣",
"md4": "啟用後自動進行段首縮進,以符合傳統中文排版習慣",
"md7": "是否顯示網路圖片角標",
"md8": "啟用後如果圖片是網路檔(非本地資源檔)則會顯示角標",
"md9": "虛擬引用關鍵字包含列表",
@ -658,9 +658,11 @@
"export15": "標籤包裹符號",
"export16": "請依次在輸入框中填寫標籤左側符號和標籤右側符號",
"export17": "新增文檔標題",
"export18": "將文檔標題以一級標題的形式插入到開頭",
"export18": "啟用後將文檔標題以一級標題的形式插入到開頭",
"export19": "Pandoc 可執行文件路徑",
"export20": "導出 Word .docx 文件需要使用 <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a> 進行格式轉換",
"export21": "導出 PDF 添加頁腳",
"export22": "開啟後在導出的 PDF 頁腳處添加 <code class='fn__code'>由思源筆記導出</code>",
"blockRef": "引用塊",
"theme11": "淺色模式下使用主題",
"theme12": "深色模式下使用主題",

View file

@ -14,8 +14,8 @@
"leftRightLayout": "左右布局",
"topBottomLayout": "上下布局",
"keyword": "关键字",
"searchMethod":"搜索方式",
"regex":"正则表达式",
"searchMethod": "搜索方式",
"regex": "正则表达式",
"keywordsLimit": "关键字数量限制",
"exportAsImage": "导出为图片",
"exportBySiYuan": "由思源笔记导出",
@ -612,7 +612,7 @@
"max": "最大化",
"md2": "代码块连字",
"md3": "启用后代码块将显示连字",
"md4": "自动进行段首缩进,以符合传统中文排版习惯",
"md4": "启用后自动进行段首缩进,以符合传统中文排版习惯",
"md7": "是否显示网络图片角标",
"md8": "启用后如果图片是网络文件(非本地资源文件)则会显示角标",
"md9": "虚拟引用关键字包含列表",
@ -658,9 +658,11 @@
"export15": "标签包裹符号",
"export16": "请依次在输入框中填写标签左侧符号和标签右侧符号",
"export17": "添加文档标题",
"export18": "将文档标题以一级标题的形式插入到开头",
"export18": "启用后将文档标题以一级标题的形式插入到开头",
"export19": "Pandoc 可执行文件路径",
"export20": "导出 Word .docx 文件需要使用 <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a> 进行格式转换",
"export21": "导出 PDF 添加页脚",
"export22": "启用后在导出的 PDF 页脚处添加 <code class='fn__code'>由思源笔记导出</code>",
"blockRef": "引用块",
"theme11": "明亮模式下使用主题",
"theme12": "暗黑模式下使用主题",

View file

@ -270,6 +270,7 @@ declare interface IExport {
pandocBin: string
paragraphBeginningSpace: boolean;
addTitle: boolean;
addFooter: boolean;
}
declare interface IEditor {

View file

@ -378,9 +378,10 @@ const initWindow = () => {
mergeSubdocs: ipcData.mergeSubdocs,
})));
try {
ipcData.pdfOptions.displayHeaderFooter = true;
ipcData.pdfOptions.headerTemplate = "<span></span>";
ipcData.pdfOptions.footerTemplate = `<div style="width:100%;margin:0 ${ipcData.left};display: flex;line-height:12px;">
if (window.siyuan.config.export.addFooter) {
ipcData.pdfOptions.displayHeaderFooter = true;
ipcData.pdfOptions.headerTemplate = "<span></span>";
ipcData.pdfOptions.footerTemplate = `<div style="width:100%;margin:0 ${ipcData.left};display: flex;line-height:12px;">
<div style="flex: 1"></div>
<svg viewBox="0 0 32 32" style="height: 10px;width: 10px;">
<path fill="#d23e31" d="M8.667 2.812c-0.221 0.219-0.396 0.417-0.39 0.438s-0.004 0.030-0.022 0.020c-0.047-0.029-0.397 0.337-0.362 0.376 0.016 0.018 0.011 0.022-0.013 0.008-0.045-0.025-0.244 0.173-0.244 0.243 0 0.023-0.013 0.033-0.029 0.023-0.037-0.023-0.127 0.074-0.096 0.104 0.013 0.013 0.002 0.023-0.023 0.023-0.060 0-0.234 0.174-0.234 0.234 0 0.025-0.010 0.036-0.023 0.024-0.024-0.024-0.336 0.264-0.753 0.692-0.7 0.72-1.286 1.291-1.304 1.274-0.012-0.012-0.021 0.009-0.021 0.046s-0.017 0.055-0.038 0.042c-0.035-0.021-0.055 0.029-0.042 0.105 0.002 0.016-0.017 0.024-0.043 0.019s-0.043 0.013-0.037 0.041c0.006 0.028-0.006 0.041-0.025 0.029s-0.128 0.075-0.24 0.193c-0.316 0.333-0.72 0.734-1.024 1.017-0.152 0.142-0.265 0.258-0.251 0.258s-0.030 0.047-0.1 0.105c-0.249 0.205-0.689 0.678-0.729 0.783-0.014 0.037-0.052 0.067-0.084 0.067s-0.059 0.027-0.059 0.059-0.014 0.051-0.030 0.041c-0.039-0.024-0.738 0.647-0.706 0.678 0.013 0.013 0.002 0.024-0.024 0.024s-0.134 0.090-0.239 0.2c-0.502 0.524-0.802 0.831-0.814 0.831-0.007 0-0.16 0.147-0.341 0.326l-0.328 0.326-0 9.032c-0 6.176 0.012 9.055 0.039 9.106 0.058 0.108 0.118 0.089 0.247-0.076 0.063-0.081 0.128-0.139 0.143-0.129s0.029-0.013 0.029-0.049 0.009-0.057 0.021-0.045c0.020 0.020 2.899-2.819 4.934-4.866 0.173-0.174 0.796-0.796 1.384-1.381s1.058-1.082 1.044-1.104c-0.013-0.022-0.008-0.029 0.012-0.017 0.052 0.032 0.25-0.159 0.218-0.21-0.015-0.024-0.008-0.031 0.016-0.016 0.043 0.027 0.199-0.114 0.199-0.181 0-0.020 0.009-0.028 0.021-0.017 0.071 0.072 0.863-0.833 0.842-0.963-0.012-0.074-0.022-4.185-0.022-9.136s-0.013-9.001-0.029-8.999-0.209 0.183-0.429 0.402zM22.214 2.895c-0.268 0.268-0.487 0.51-0.487 0.54s-0.011 0.042-0.023 0.029c-0.018-0.019-1.229 1.165-2.765 2.703-0.084 0.084-0.771 0.774-1.527 1.532l-1.374 1.379v9.15c0 5.033 0.009 9.15 0.021 9.15 0.042 0 0.203-0.183 0.181-0.206-0.013-0.013 0.001-0.023 0.031-0.024s0.166-0.124 0.302-0.275c0.136-0.15 0.358-0.377 0.492-0.505s0.487-0.478 0.783-0.78c0.296-0.302 0.647-0.654 0.78-0.783 0.679-0.66 1.153-1.132 1.139-1.132-0.009 0 0.141-0.16 0.333-0.356s0.362-0.35 0.378-0.341 0.029-0.015 0.029-0.051 0.011-0.055 0.023-0.042c0.029 0.029 0.129-0.067 0.129-0.125 0-0.023 0.013-0.036 0.029-0.027 0.027 0.016 0.23-0.17 0.21-0.192-0.005-0.006 0.003-0.014 0.019-0.018 0.053-0.014 0.116-0.088 0.099-0.117-0.010-0.016 0.011-0.029 0.045-0.029s0.051-0.017 0.038-0.038c-0.013-0.021-0.008-0.038 0.011-0.038s0.407-0.369 0.862-0.819l0.827-0.819v-9.068c0-4.988-0.011-9.095-0.023-9.128-0.036-0.094-0.041-0.089-0.559 0.428z"></path>
@ -390,6 +391,7 @@ const initWindow = () => {
</svg>
<a style="text-decoration:none;color:#4285f4;font-size: 8px;margin-left: 4px" href="https://b3log.org/siyuan">${window.siyuan.languages.exportBySiYuan}</a>
</div>`;
}
window.siyuan.printWin.webContents.printToPDF(ipcData.pdfOptions).then((pdfData) => {
fetchPost("/api/export/exportHTML", {
id: ipcData.rootId,

View file

@ -19,6 +19,7 @@ package conf
type Export struct {
ParagraphBeginningSpace bool `json:"paragraphBeginningSpace"` // 是否使用中文排版段落开头空两格
AddTitle bool `json:"addTitle"` // 是否添加标题
AddFooter bool `json:"addFooter"` // 是否添加页脚
BlockRefMode int `json:"blockRefMode"` // 内容块引用导出模式2锚文本块链3仅锚文本4块引转脚注0使用原始文本1使用 Blockquote。0 和 1 都已经废弃 https://github.com/siyuan-note/siyuan/issues/3155
BlockEmbedMode int `json:"blockEmbedMode"` // 内容块引用导出模式0使用原始文本1使用 Blockquote
BlockRefTextLeft string `json:"blockRefTextLeft"` // 内容块引用导出锚文本左侧符号,默认留空
@ -33,6 +34,7 @@ func NewExport() *Export {
return &Export{
ParagraphBeginningSpace: false,
AddTitle: true,
AddFooter: true,
BlockRefMode: 3,
BlockEmbedMode: 1,
BlockRefTextLeft: "",