I am trying to read a PDF file in Rail using Rail Mani. Here's my code
& lt;% reader = PDF :: Reader.new ('/ uploads / pdf / pdf_1.pdf') putser.pdf_version says putser.info putser.metadata Puts Reader.page_mount% & gt; There is a problem loading the PDF file. Also, I have this url http: // localhost: 3000 / uploads / pdf / pdf_1.pdf Using this error: Input should be an IO-like object or file name What is wrong with IDK Any help would be appreciated.
Try to use:
Reader = PDF :: Reader.new (rail.root.joint ('upload / pdf / pdf_1 pdf')) And if you want it to appear on the page then you should do something like:
& lt;% reader = PDF :: Reader.new (Rails.root.join ('uploads / pdf / pdf_1.pdf'))%> & Lt;% = reader.pdf_version + reader.info + reader.metadata + reader.page_count% & gt;
No comments:
Post a Comment