I'm new to MVC and would like to find out how to view PDF files. Specifically, I have a bunch of PDF files on server. I would like to render links to those PDF files using MVC and allow the user to click on a link to view the PDF file in a browser. Thank you in advance for your help.
You may use some javascript or pdf readers controll.
Look at : http://viewerjs.org/
Related
I have a rails app that generates a pdf for a given html partial. In the partial I have a number of links that have a target of _blank, however in the generated PDF the target looks like it is being ignored.
I just want the pdf to open links in a new tab/window.
A collaborators from PDFKIT said
"This sounds like a problem with wkhtmltopdf (which is what renders the pdf from the html). (Pdfkit just wires up everything between ruby/rails and that binary.)"
Any help would be appreciated.
Regards,
Sean Hubers Answer:
PDFs are not marked up with HTML. How a link click is handled in a PDF
depends on the PDF viewer you are using. Modern browsers with built-in
PDF viewers may navigate to the page within the same frame as the PDF
view and that is not something that can be controlled with an HTML
element attribute. What happens if your link is clicked when the PDF
is being viewed in Adobe Acrobat or Mac Preview? You're at the whim of
the software and operating system. Sorry to bear the bad news but this
is the reality of the PDF format.
This is my first Grails project & I can't seem to do this very simple thing! I am trying to display a list of PDF forms in one page that I have saved under a folder called forms under my_project/grails-app/views/forms and want to open the PDF form in a new window when clicked.
In my .gsp file I am trying to access the forms like this:
Form #1
But that's giving me a 404 error.
I have found couple of solutions like this one or this question (which is very similar to mine)...but first of all, i don't need to upload/download the file. Second, i don't need to render the file either. All I want to do is just click the link and open the PDF file in a new window/tab. Am I saving the PDF files in a wrong place? Please help!! Thank you.
Place your file/directory into grails-app/assets so that you have grails-app/assets/forms/form_one.pdf then you can use the resource tag like this:
Form #1
The grails-app/views directory is used for views rendered by controllers, where as the grails-app/assets directory is used for static and pre-processed assets.
I created a pdf file with 5 pages in the iPad's document directory.
Each page has a paragraph describing the page (e.g. "Page1", "Page2", etc.)
The pdf is totally code generated using UIGraphicsBeginPDFPage.
I would like to change the paragraph in an hyperlink targeting another page inside the pdf file (or an external webpage).
So when the pdf is opened in a PDF reader, the user could change page just clicking on the hyperlink.
Is this something possible with the SDK?
Thank you in advance
I have a MVC3, Razor engine application having 8 different views(.cshtml).I have these pages for users to enter personal details and other things.I have a requirement to download the content of all these 8 pages(.cshtml) as shown in browser in a button click as a single PDF file and save it.The pages(.cshtml) contains controls like dropdownbox,calender,radio button etc.Some of the contents in the views are loaded from models.
You can try using synchronised pechkin which is available as a nuget package.
This works on html so you can use a templating engine like RazorGenerator to convert Razor views to html.
I want to embed a javascript function into a pdf file generated by jasper.
it comes to my mind because I want to make the pdf file auto open printing dialog.
after reading this question and tried this example I want to do the same.
but I use iReport designer to create my pdf templates and then export using struts actions, any idea how to embed javascript with ireport?
thanks
You can try to use the net.sf.jasperreports.export.pdf.javascript property.
The information about this property is here.