Peter Ward avatar Peter Ward committed 6f76c09

strange fullsize mode.

Comments (0)

Files changed (1)

shinypress/handlers/pdf.py

     return (choice(seq) for i in xrange(n))
 
 template = env.from_string(r"""
+%% if not fullsize %%
 %% for page in range(1, n_pages+1) %%
-\begin{frame}
+\begin{frame}<frameopts>
 \includegraphics[width=\linewidth,page=<page>]{<filename>}
 \end{frame}
 %% endfor %%
+%% else %%
+{
+\backgroundoff
+%% for page in range(1, n_pages+1) %%
+\usebackgroundtemplate{\includegraphics[width=\paperwidth,page=<page>]{<filename>}}
+\frame[plain]{}
+%% endfor %%
+}
+%% endif %%
 """)
 
 def render(spec):
-    n_pages, filename = spec.split(' ', 1)
-    n_pages = int(n_pages)
+    part, spec = spec.split(' ', 1)
+
+    frameopts = ''
+    fullsize = False
+
+    if part == '[plain]':
+        frameopts = '[plain]'
+        part, spec = spec.split(' ', 1)
+
+    if part == '[fullsize]':
+        fullsize = True
+        part, spec = spec.split(' ', 1)
+
+    n_pages = int(part)
+    filename = spec
+
     content = open(filename, 'rb').read()
     f = StringIO(content)
     f.name = ''.join(selection(lowercase, 12)) + '.pdf'
     filename = basename(f.name)
-    return (template.render(filename=filename, n_pages=n_pages), [f])
+    return (
+        template.render(
+            frameopts=frameopts,
+            fullsize=fullsize,
+            filename=filename,
+            n_pages=n_pages,
+        ),
+        [f],
+    )
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.