PDF to Image Conversion
I download a pdf file via Safari and I "open it" with a Pythonista script, thus the script runs in Appex mode.
The script splits the PDF into its pages (using pyPDF2).
I want to display each PDF page (one at a time, asking the user if he wants to keep this page or not) as the background of the share extension view.
I already have done that with a photo but, here, I need to **convert the PDF page file into either an image, either a JPG/PNG **file...
Somebody can help me?
Thanks for your so quick answer.
I had searched through the forum, but I guess I gave bad search arguments...sorry
Even the console.quicklook does not display something with a pdf file.
If I click on a PDF in Pythonista, the little menu (open in or Quick Look), if I click "Quick Look" displays the PDF correctly.
Huh. You wouldn't be able to display a UI on top of that anyway I don't think.
In other scripts, in apex mode, I start a ui.view as background of the share sheet.
And in the ui.view, I display a ui.ImageView with the background bounds, filled with a photo,
or an ui.WebView.
Thus I hoped to transform the pdf into a jpg and display the jpg in the ui.ImageView as background of my Share Sheet window.
I'm not sure I'm clear enough in my poor English...
Web views can render PDFs, so maybe you can split the original PDF into multiple (1-page) PDF files (using PyPDF2), and then show them (one after another) using a web view?
...it would also be possible to render a PDF into a JPEG/PNG image using
objc_utilof course, but I think the approach I outlined above would be easier, and it doesn't seem like you'd need the image for anything other than displaying it in the UI.
Thanks, I'll try with the WebView, because using objc_util seems to complex for me..
But how can I load a pdf local file in WebView, I only know load_url and load_html, sorry
import urlparse, urllib def path2url(path): return urlparse.urljoin( 'file:', urllib.pathname2url(path))
I'am sorry because I should be able to find that my-self...
I really love your app for all I can do with it.