Add the advanced-pdf-export plugin by shrekbytes

This commit is contained in:
2026-08-22 12:15:16 -04:00
parent 0d897259b7
commit a815b35749
6 changed files with 829 additions and 2 deletions

View File

@@ -23,5 +23,11 @@
"promptDelete": true, "promptDelete": true,
"alwaysUpdateLinks": true, "alwaysUpdateLinks": true,
"useTab": false, "useTab": false,
"attachmentFolderPath": "Attachments" "attachmentFolderPath": "Attachments",
"pdfExportSettings": {
"pageSize": "Letter",
"landscape": false,
"margin": "1",
"downscalePercent": 80
}
} }

View File

@@ -7,5 +7,6 @@
"obsidian-vimrc-support", "obsidian-vimrc-support",
"tag-wrangler", "tag-wrangler",
"maps", "maps",
"jekyll-publish" "jekyll-publish",
"advanced-pdf-export"
] ]

View File

@@ -0,0 +1,159 @@
{
"pageSize": "Letter",
"orientation": "portrait",
"preset": "minimal",
"name": "Minimal",
"fontFamily": "Georgia, serif",
"fontSize": 12,
"lineHeight": 1.6,
"paragraphSpacing": 0.45,
"headingScale": 0.88,
"accentColor": "#333",
"bodyColor": "#222",
"headingColor": "#111",
"h1BorderBottom": false,
"h2BorderBottom": false,
"centerH1": false,
"blockquoteBg": "#f8f8f8",
"blockquoteBorderColor": "#ccc",
"codeBackground": "#f4f4f4",
"codeFontSize": 0.82,
"codeFontFamily": "'JetBrains Mono', monospace",
"codeTheme": "none",
"tableHeaderBg": "#efefef",
"tableStriped": false,
"pageBackground": "#ffffff",
"marginTop": 10,
"marginBottom": 12.7,
"marginLeft": 12.7,
"marginRight": 12.7,
"headerText": "",
"footerText": "",
"showHeader": true,
"showFooter": true,
"showHeaderBorder": false,
"showFooterBorder": false,
"showPageNumbers": true,
"pageNumberPosition": "right",
"pageNumberStart": 1,
"pageNumberFormat": "{{current}} / {{total}}",
"showHeaderOnFirstPage": true,
"showFooterOnFirstPage": true,
"headerAlignment": "right",
"footerTextAlignment": "left",
"headerFontSize": 9,
"headerFontColor": "#999999",
"footerFontSize": 9,
"footerFontColor": "#aaaaaa",
"linkUnderline": true,
"frameEnabled": false,
"frameColor": "#000000",
"frameThickness": 4,
"frameMargin": 8,
"frameStyle": "solid",
"hideFrontmatter": false,
"customFontName": "iA Writer Mono V",
"customCodeFontName": "",
"codeFontLigatures": false,
"autoBreakH1": false,
"autoBreakH2": false,
"includeFilenameAsTitle": false,
"previewScale": 0.9,
"customPageWidth": 210,
"customPageHeight": 297,
"headerHeight": 0,
"footerHeight": 0,
"headerImagePath": "",
"headerImageMargin": 0,
"footerImagePath": "",
"footerImageMargin": 0,
"backgroundImageEnabled": false,
"backgroundImagePath": "",
"backgroundImageSize": "cover",
"backgroundImageScope": "full-page",
"backgroundImageOpacity": 1,
"includeOutline": true,
"presetSnapshots": {
"default": {
"name": "Default",
"fontFamily": "Georgia, serif",
"fontSize": 13,
"lineHeight": 1.85,
"paragraphSpacing": 0.65,
"headingScale": 1,
"accentColor": "#7c6af7",
"bodyColor": "#1a1a2e",
"headingColor": "#0d0d1a",
"h1BorderBottom": false,
"h2BorderBottom": true,
"centerH1": false,
"blockquoteBg": "transparent",
"blockquoteBorderColor": "#7c6af7",
"codeBackground": "#f0f0f8",
"codeFontSize": 0.85,
"codeFontFamily": "'Courier New', monospace",
"codeTheme": "github-light",
"tableHeaderBg": "#f0f0f8",
"tableStriped": true,
"pageBackground": "#ffffff",
"marginTop": 20,
"marginBottom": 20,
"marginLeft": 25,
"marginRight": 25
},
"minimal": {
"name": "Minimal",
"fontFamily": "__custom__",
"fontSize": 12,
"lineHeight": 1.6,
"paragraphSpacing": 0.45,
"headingScale": 0.88,
"accentColor": "#333",
"bodyColor": "#222",
"headingColor": "#111",
"h1BorderBottom": false,
"h2BorderBottom": false,
"centerH1": false,
"blockquoteBg": "#f8f8f8",
"blockquoteBorderColor": "#ccc",
"codeBackground": "#f4f4f4",
"codeFontSize": 0.82,
"codeFontFamily": "'JetBrains Mono', monospace",
"codeTheme": "none",
"tableHeaderBg": "#efefef",
"tableStriped": false,
"pageBackground": "#ffffff",
"marginTop": 10,
"marginBottom": 12.7,
"marginLeft": 12.7,
"marginRight": 12.7
},
"academic": {
"name": "Academic",
"fontFamily": "'Times New Roman', Times, serif",
"fontSize": 12,
"lineHeight": 2,
"paragraphSpacing": 0,
"headingScale": 0.95,
"accentColor": "#1a3a6b",
"bodyColor": "#000",
"headingColor": "#000",
"h1BorderBottom": true,
"h2BorderBottom": true,
"centerH1": true,
"blockquoteBg": "transparent",
"blockquoteBorderColor": "#999",
"codeBackground": "#f9f9f9",
"codeFontSize": 0.88,
"codeFontFamily": "'Courier New', monospace",
"codeTheme": "solarized-light",
"tableHeaderBg": "#e8e8e8",
"tableStriped": false,
"pageBackground": "#ffffff",
"marginTop": 25,
"marginBottom": 25,
"marginLeft": 30,
"marginRight": 30
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
{
"id": "advanced-pdf-export",
"name": "Advanced PDF Export",
"version": "4.4.0",
"minAppVersion": "1.13.0",
"description": "Export notes as pixel-perfect PDFs with live preview, style presets, manual page breaks, tables, and full layout control.",
"author": "ShrekBytes",
"authorUrl": "https://github.com/ShrekBytes",
"isDesktopOnly": true,
"fundingUrl": "https://shrekbytes.github.io/support/"
}

View File

@@ -0,0 +1,333 @@
/* Advanced PDF Export — plugin styles */
.mpdf-modal {
width: 96vw;
max-width: 1800px;
height: 90vh;
max-height: 90vh;
overflow: hidden;
}
.mpdf-modal .modal-content {
padding: 0;
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
}
/* Topbar */
.mpdf-topbar {
display: flex;
align-items: flex-start;
padding: 6px 12px;
min-height: 44px;
background: var(--background-secondary);
border-bottom: 1px solid var(--background-modifier-border);
flex-shrink: 0;
}
.mpdf-topbar-left {
display: flex;
align-items: center;
gap: 8px;
row-gap: 4px;
flex: 1;
min-width: 0;
flex-wrap: wrap;
}
.mpdf-topbar-title {
flex-shrink: 1;
min-width: 40px;
max-width: 220px;
font-size: 12px;
font-weight: 500;
color: var(--text-normal);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 6px;
opacity: 0.85;
border-left: 1px solid var(--background-modifier-border);
}
.mpdf-topbar-right {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.mpdf-ctrl {
display: flex;
align-items: center;
gap: 5px;
flex-shrink: 0;
}
.mpdf-ctrl-label {
font-size: 11px;
color: var(--text-muted);
white-space: nowrap;
}
.mpdf-select {
background: var(--background-primary);
color: var(--text-normal);
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
font-size: 12px;
padding: 3px 6px;
cursor: pointer;
outline: none;
}
.mpdf-select:hover {
border-color: var(--interactive-accent);
}
.mpdf-btn {
display: flex;
align-items: center;
gap: 4px;
background: var(--background-primary);
color: var(--text-normal);
border: 1px solid var(--background-modifier-border);
border-radius: 5px;
font-size: 12px;
padding: 4px 10px;
cursor: pointer;
flex-shrink: 0;
transition: border-color 0.12s, color 0.12s, background-color 0.12s;
}
.mpdf-btn:hover {
border-color: var(--interactive-accent);
color: var(--interactive-accent);
}
.mpdf-btn-primary {
background: var(--interactive-accent);
color: var(--text-on-accent);
border-color: transparent;
font-weight: 500;
}
.mpdf-btn-primary:hover {
background: var(--interactive-accent-hover);
color: var(--text-on-accent);
}
.mpdf-btn-icon {
padding: 4px 6px;
}
.mpdf-btn-icon svg {
width: 16px;
height: 16px;
}
.mpdf-btn:disabled,
.mpdf-btn-primary:disabled {
opacity: 0.55;
cursor: not-allowed;
pointer-events: none;
}
/* Export PDF split button: main action + dropdown arrow, one visual unit */
.mpdf-split-btn {
display: flex;
align-items: center;
flex-shrink: 0;
}
.mpdf-split-btn-main {
border-radius: 5px 0 0 5px;
}
.mpdf-split-btn-arrow {
border-radius: 0 5px 5px 0;
padding: 4px 6px;
border-left: 1px solid rgba(255, 255, 255, 0.25);
}
.mpdf-split-btn-arrow svg {
width: 14px;
height: 14px;
}
.mpdf-page-count {
font-size: 11px;
color: var(--text-muted);
white-space: nowrap;
flex-shrink: 0;
}
/* Main layout */
.mpdf-main {
display: flex;
flex: 1;
overflow: hidden;
}
.mpdf-editor-panel {
display: flex;
flex-direction: column;
width: 42%;
min-width: 200px;
border-right: 1px solid var(--background-modifier-border);
background: var(--background-primary);
flex-shrink: 0;
}
.mpdf-editor {
flex: 1;
background: transparent;
color: var(--text-normal);
border: none;
outline: none;
resize: none;
font-family: var(--font-monospace);
font-size: 13px;
line-height: 1.75;
padding: 16px 18px;
tab-size: 2;
}
.mpdf-editor::placeholder {
color: var(--text-faint);
}
/* Keeps the loading overlay as a non-scrolling sibling of .mpdf-preview. */
.mpdf-preview-container {
flex: 1;
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
}
.mpdf-preview {
flex: 1;
background: var(--background-secondary-alt, #2a2a30);
overflow-y: auto;
display: flex;
flex-direction: column;
align-items: center;
padding: 28px 20px 48px; /* extra bottom so last page label isn't clipped */
gap: 24px;
}
.mpdf-loading-overlay {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.38);
backdrop-filter: blur(3px);
-webkit-backdrop-filter: blur(3px);
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 14px;
z-index: 20;
pointer-events: none; /* let clicks through to cancel/settings while loading */
}
.mpdf-loading-overlay.mpdf-is-active {
display: flex;
}
.mpdf-spinner {
width: 34px;
height: 34px;
border: 3px solid rgba(255, 255, 255, 0.12);
border-top-color: var(--interactive-accent);
border-radius: 50%;
flex-shrink: 0;
}
@media (prefers-reduced-motion: no-preference) {
.mpdf-spinner {
animation: mpdf-spin 0.65s linear infinite;
}
@keyframes mpdf-spin {
to { transform: rotate(360deg); }
}
}
.mpdf-loading-text {
font-size: 12px;
color: rgba(255, 255, 255, 0.65);
font-family: var(--font-interface);
letter-spacing: 0.02em;
}
/* width/height set inline to match the scaled page footprint */
.mpdf-page-wrap {
position: relative;
flex-shrink: 0;
}
.mpdf-page-label {
position: absolute;
top: -18px;
left: 0;
font-size: 10px;
color: rgba(255, 255, 255, 0.3);
font-family: var(--font-monospace);
white-space: nowrap;
}
/* Clips the shadow-host to the scaled footprint; width/height set inline. */
.mpdf-page-scale {
overflow: hidden;
position: relative;
}
/* width/accent kept in CSS to avoid inline styles in JS */
.mpdf-topbar .mpdf-zoom-slider {
width: 64px;
accent-color: var(--interactive-accent);
}
/* Number inputs for the custom page-size control in the topbar */
.mpdf-custom-size-input {
width: 52px;
background: var(--background-primary);
color: var(--text-normal);
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
font-size: 12px;
padding: 3px 5px;
outline: none;
/* Suppress native spinners so the compact topbar stays tidy */
-moz-appearance: textfield;
}
.mpdf-custom-size-input::-webkit-outer-spin-button,
.mpdf-custom-size-input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.mpdf-custom-size-input:hover,
.mpdf-custom-size-input:focus {
border-color: var(--interactive-accent);
}
/* Utility: toggle visibility without affecting layout flow.
Doubled class selector bumps specificity above single-class rules
(e.g. .mpdf-ctrl, Obsidian's own .setting-item) without needing !important. */
.mpdf-is-hidden.mpdf-is-hidden {
display: none;
}
/* Static positioning for the per-page shadow-DOM host; width/height/transform set inline */
.mpdf-shadow-host {
position: absolute;
top: 0;
left: 0;
transform-origin: top left;
}