@joaodotwork/md-2-pdf 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/md_to_pdf.py +15 -7
- package/package.json +1 -1
package/md_to_pdf.py
CHANGED
|
@@ -166,14 +166,22 @@ def convert_markdown_to_pdf(
|
|
|
166
166
|
print(f"Using PDF engine: {pdf_engine}")
|
|
167
167
|
|
|
168
168
|
# Convert to PDF using pandoc
|
|
169
|
+
cmd = [
|
|
170
|
+
'pandoc',
|
|
171
|
+
input_for_pandoc,
|
|
172
|
+
'-o', output_path,
|
|
173
|
+
f'--pdf-engine={pdf_engine}',
|
|
174
|
+
'-V', 'geometry:margin=0.8in',
|
|
175
|
+
'-V', 'fontsize=11pt',
|
|
176
|
+
'-V', 'linestretch=1.2',
|
|
177
|
+
'-V', 'colorlinks=true',
|
|
178
|
+
'-V', 'linkcolor=blue',
|
|
179
|
+
'-V', 'urlcolor=blue',
|
|
180
|
+
'-V', 'header-includes=\\renewcommand{\\rule}[2]{\\vspace{1em}}'
|
|
181
|
+
]
|
|
182
|
+
|
|
169
183
|
try:
|
|
170
|
-
subprocess.run(
|
|
171
|
-
'pandoc',
|
|
172
|
-
input_for_pandoc,
|
|
173
|
-
'-o', output_path,
|
|
174
|
-
f'--pdf-engine={pdf_engine}',
|
|
175
|
-
'-V', 'geometry:margin=1in'
|
|
176
|
-
], check=True, capture_output=True)
|
|
184
|
+
subprocess.run(cmd, check=True, capture_output=True)
|
|
177
185
|
print(f"Successfully converted {input_path} to {output_path}")
|
|
178
186
|
return True
|
|
179
187
|
except subprocess.CalledProcessError as e:
|