Skip to content

Commit 95451c6

Browse files
committed
File to compile pptx files to pdf
1 parent daac022 commit 95451c6

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.DS_Store
2+
/Part_1_Resources_for_computational_modellers/Part1.pptx
3+
/Part_1_Resources_for_computational_modellers/*.pdf
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import os
2+
from subprocess import call
3+
4+
from pdfrw import PdfReader, PdfWriter
5+
6+
sections = ['Introduction','1_Experimental_datasets', '2_Structured_data_from_literature', '3_Analysis_tools', '4_Simulation_environments', '5_Model_sharing', '6_Computing_infrastructure', '7_Open_source_initiatives']
7+
#sections = ['Introduction','1_Experimental_datasets', '2_Structured_data_from_literature']
8+
9+
big_file = PdfWriter()
10+
11+
for section in sections:
12+
13+
for f in os.listdir(section):
14+
fpath = section+'/'+f
15+
if os.path.isfile(fpath) and fpath.endswith('pptx'):
16+
print("Incorporating: %s"%fpath)
17+
call(["libreoffice", "--headless", "--invisible", "--convert-to", "pdf", fpath])
18+
19+
pdf_file_name = f.replace('pptx','pdf')
20+
pdf_file = PdfReader(pdf_file_name)
21+
print(" Adding pages from %s"%pdf_file_name)
22+
big_file.addpages(pdf_file.pages)
23+
24+
25+
big_file.write('Part1.pdf')
26+
27+
28+
print("Done.")
29+
30+
31+

0 commit comments

Comments
 (0)