steveryan

steveryan

Phoenix LiveView pdf viewer

Hey All,

Building a Phoenix LiveView app that allows you to upload a file (currently only markdown supported) and advance through the pages one at a time, and I would like it to support pdf files. I have been looking for a package that can do this, but I can’t find one.

I’d love to be able to provide a pdf, and a page number and render that page of the pdf in my LiveView page.

Is there anything out there like this for Elixir/Phoenix?

Most Liked

egze

egze

You will need hooks and pdf.js, or no hooks but an iframe.

zimt28

zimt28

You probably won’t find an existing solution but it should be easy to build one yourself:

bratsche

bratsche

In the past I’ve used the command line tool pdfimages that’s included in poppler and had some success with it. For example, you can shell out to pdfimages -list <filename> to get a list of pages with some information about them, and you can convert the PDF into a series of images that you can render in LiveView.

Last Post!

mayel

mayel

I’ve just experimented with the SVG support. There’s an issue with multipage PDFs in that it generates multi-page SVGs which unfortunately doesn’t seem supported by browsers. You can do one page at a time though with pdfseparate input.pdf ouput-%d.pdf (that command also comes with poppler) and then pdftocairo -svg on each page.

Where Next?

Popular in Questions Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement