Skip to content

Instantly share code, notes, and snippets.

View vinayak-mehta's full-sized avatar
🤕
Recovering

Vinayak Mehta vinayak-mehta

🤕
Recovering
View GitHub Profile
@vinayak-mehta
vinayak-mehta / pdf2png.txt
Created September 6, 2020 11:59 — forked from zooba/pdf2png.txt
Step by step converting a PDF page to PNG using WinRT
Python 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 10:03:53) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, time
>>> PDF_FILENAME = input("Path to PDF: ")
>>> OUT_FILE = os.path.abspath(input("Path to output PNG: "))
>>>
>>> import winrt.windows.data.pdf as PDF
>>> from winrt.windows.storage import StorageFile
>>> op = StorageFile.get_file_from_path_async(PDF_FILENAME)
>>> time.sleep(0.5) # should really await, but this is easier