How to embed PDF viewer in DSPACE - pdf

How can I embed PDF viewer in my DSPACE instance. I have tried many solution but nothing works. There are many suggestion on DSPACE official site
https://wiki.duraspace.org/display/DSPACE/Document+Viewer+Integration
No soluton has a documnetation how to configure these viewer in dspace code.
I want a step wise soultion for embeding PDF Viewer. Please help me out of this problem. Thanks in advance.
I have researched through these site -
https://wiki.duraspace.org/display/DSPACE/Document+Viewer+Integration
http://peterpants.blogspot.com/2010/02/document-preview-in-dspace-using-google.html

It depends which version and which UI of DSpace you are using. I will describe roughly what we did to embed PDF.js into DSpace 6.3 JSPUI. We released all necessary code changes on github, so please take a look over there for details.
DSpace uses maven overlays to separate local code changes from the officially released code. Therefore, I will use paths within these overlays in the following description. If files that we changed do not exists within your local code repository, you have to copy them from there original location within [dspace-source]/dspace-jspui/src/main. It should also work if you do the code changes directly there, but I would consider that bad practice.
We added PDF.js and all files it needs to dspace/modules/jspui/src/main/webapp/static/pdfjs. We then changed dspace/modules/jspui/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java. This class builds the item view. While I wish there would be a better separation of concerns, some HTML code is generated by this class, including the section of the item view that list all bitstreams. For every file that is listed, we check if its mime type is set to application/pdf and add a "preview" button for those files. The preview button links to the html site that renders the pdf viewer and loads the targeted file. We also added an attribute "download" to the default "Open/View" button, to ensure that it does not start another PDF viewer of the browser, but downloads the file. This is important to have one button called "preview" that opens the embeded PDF viewer and one button "download" that downloads the file to the user's computer. You can change the name of the button from "open/view" into "download" in the DSpace's message catalog. Last but not least we added JavaScript to dspace/modules/jpsui/src/main/webapp/display-item.jsp. The JavaScript suppress that the PDF viewer is loaded as a normal site, but loads it as an overlay over the item view, using JQuery UI. Then we wrote a small CSS file that helps us to position that overlay within the item view and referenced that file in dspace/modules/jspui/src/main/webapp/layout/header-default.jsp.
As mentioned above all these changes are published as open source under the DSpace Source Code BSD License on github.

Related

PDF - Open Bookmarks Panel when pdf opens

When I open a certain pdf file on SharePoint, I wish to see the Bookmarks Navigation tab open by default. I can do this manually by File > Properties > initial View and changing the Navigation tab to "Bookmarks Panel and Page".
I need to do this with hundreds of pdf files and then upload them to SharePoint.
I am using VBA. I don't mind using other forms of automation.
Currently, I have AVDoc (CAcroAVDoc) and can open the Bookmarks Pane but it's not changed in the settings.
AVDoc.SetViewMode 3
I tried PDDoc.SetInfo etc but nothings changing the "settings".
Any suggestion will be appreciated.
I am running a lot of code in Excel VBA, that does a lot of pdf manipulation. The only thing that remains is to change the settings.
With Acrobat as the runtime, there is no scriptable interface to the initial view settings. However, you can easily use any of several .NET PDF libraries to make this change. A Google search for ".NET PDF Library" will yield both free and commercial varieties. You'll need to research which one is best for your task and skill set.

Xamarin Forms UWP - Display PDF

Please, help me and tell me what am I missing.
My goal is to display simple PDF file (stored locally for example) in the WebView control. Can I bind path of the file to the Source property of the WebView? Or what is the correct way to show PDF in UWP?
P.S. and if the only option is to do like here - how must I add pdf.js to my project??
My goal is to display simple PDF file (stored locally for example) in the WebView control.
If you want to display pdf in WebView control, then the methods in Display a Local PDF File in a WebView is most like the only way to solve your problem.
You can follow the steps in the xamarin official document, and here are some additional tips we need to pay attention to:
After downloading pdfjs, for UWP app, you need to copy the entire folder into the Assets folder, make sure that the folder is named "pdfjs", otherwise you will need to modify the code to change the path.
Your .pdf file should be stored into the Content folder under the Assets folder, it means you will need to create a new folder named "Content" under Assets and copy your .pdf file into this folder. Otherwise, you will also need to modify the code to change the path.
After copying your .pdf file into the "Content" folder, don't forget to change the Build Action of this file to Content like this:
Or what is the correct way to show PDF in UWP?
In uwp app, you can use Image to show PDF file, you can refer to the official PDF document sample. But I don't know if PDF can be displayed as Image in Android and IOS apps, since you're developing a cross-platform project, I think it's better to use the built-in method to solve such problem.
If a demo for xamarin UWP is needed, you can leave a comment, I will upload my demo later.

PDF downloading instead of opening in new tab

This is not a back-end programming question. I can only modify the markup or script (or the document itself). The reason I'm asking here is because all my searches for appropriate terms inevitably lead to questions and solutions about programming this functionality. I'm not trying to force it via progrmaming; I have to find out why this PDF is behaving differently.
So:
I have a bunch of links to PDFs on a page. Most of them open in new tabs, but one of them, the most recent, starts to open in a tab, but then the tab closes and the PDF gets downloaded as a file instead. All markup is consistent - there's nothing differnt about the odd-man-out except the actual URL.
You can see this here:
http://calwater.mwnewsroom.com/Investor-Relations/Financial-Reports/Annual-Reports
All annual reports up to 2012 open in a new tab, but 2013 downloads instead.
This leads me to believe that there is some meta-data property of the PDF itself that tells it how to open, and that, in this case, the 2013 PDF was created using different settings.
Apparently, the PDF was saved out to PDF from InDesign.
Does anyone have any insight?
Problem solved. There was simply an error in the string (like an extra period) that references the attachment such that it couldn't tell it was a PDF. Fixing the reference fixed the problem.

PDF file custom zoom level

i have a task about .PDF files that pdf file should open in browser with custom zoom level of 125% or 150%, i tried many times, but it is not working properly in firefox, as it implements zoom on PDF file but it switch on page#2, i study the adobe's given parameters for PDF file and tried to use them as following in href,
"SICS-47.pdf?page=1&zoom=125,0,0"
"SICS-47.pdf#page=1&zoom=125,0,0"
but no success, anyone here can help me please ?
thank you so much in advance.
The adobe partner reference states on page 5 that this is for IE and Netscape. I'm not sure how old this document is, but you might want to check the Firefox support for this functionality as it could be incomplete.
Reference: Adobe Partner
Another thing you could do is modify the PDF content to make sure the document opens properly. Depending on which tool you're using you could use a free library like the Perl API2 library or a paid tool like the Java iText library. Maybe there are command line tools out there that do the same, but I'm not aware of them.

Is there any file pdf version which allow for automatic(or manual) addition of http source of document?

Is there any pdf version which allow for automatic(or manual) addition of http source of document ?
Scenarion of this problem from user side looks like that :
I found disire document in pdf format on web.
I save it.
In a few months I open this document and I wish to find the web page where I've found it.
It would be nice to have somewhere address of that file, of course it could be manually written in soe text file, but usually there are problems with copy+paste of pdf documents titles.
If you can modify your PDF files before sending them to the browser, then there are several places where you could put the URL where the document came from:
You could use a node in the "logical structure" tree (chapter 14 part 7 of the PDF reference document). This tree will show up in Acrobat Reader in the "Model Tree" tab.
You could add a hyperlink annotation to the top or bottom of each page, or the first page, or in a new page that you can add at the beginning or at the end of the file. I personally think this is the best approach since the link will be click-able.
You could add a button field on a page that fires a GoTo action that is linked to the source URL. Actions are explained in chapter 12 - Interactive Features of the PDF reference document.
You could add a bookmark(outline) that points to a named destination that is linked to the source URL. Named Destinations are also explained in chapter 12. This approach can also be used with just one click, and it is possible to hide the bookmarks tab if we will not use it.
You could add it as a Document property as #Bobrovsky said.
PDF allows you to add custom values to document information dictionary (see 14.3.3, "Document Information Dictionary" in PDF Reference). You might put your URL there. Adobe Reader will show custom values in Document Properties dialog on the Advanced tab.
Starting from PDF 1.4 (Acrobat 5x and later) you might add URL to XMP Metadata stream referenced from document catalog (see 14.3 Metadata in PDF Reference). Adobe Reader will show metadata properties too if you put them in Custom scheme.
Acrobat Professional could be used to add custom values or XMP metadata. Almost any PDF library that can open and save PDFs could be used for the task too.
I think there is no other places in a PDF document that you can use to store your information.
PDF Reference