Xamarin Forms UWP - Display PDF - 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.

Related

How to embed PDF viewer in DSPACE

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.

How can I upload a whole folder of PDF files, So that I can skim through each file without having to upload each one of them individually

I have a folder of PDF files, what I want to do is build a small app with directional arrows that when pressed should upload the next PDF file from the uploaded/Selected folder.
I have tried uploading single PDF and I was able to view it, but I'm unable to find any good resource on how to upload a whole directory inside the application for me to not upload each PDF every single time.
I should be able to change my current opened PDF to the next one inside the folder.
The way to do this in Vue is as follows:
Make a input field and attach the event "v-on:input" with the function that will be called when the input is selected.
Don't forget to add "webkitdirectory mozdirectory" for firefox and chrome browsers.
Inside the function fetch the input query via "document.querySelectorAll('input');". The information of files will be inside files object.

Open documents in Xamarin Forms

I would like opening documents in a Xamarin Forms app possibly without writing platform-specific code.
Documents could be PDF or Word files and I do NOT want to open documents inside the app, rather I want to use the default app: default Pdf Reader and Word (if installed). Any idea?
I am trying by using Device.OpenUri(new Uri("file:///Assets/pdf-sample.pdf")) and setting PDF file Build Action=Embedded Result, unfortunately without success.
You can do it simply with webview (there goes an example: https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/display-pdf/)

Illustrator/PS images when sending to another computer?

I'm not sure how Photoshop works but when I receive an AI file from another computer I get an error regarding the images:
'Could not find the link file 'exampleimage.jpg'.
So I'm guessing the other person would have to send me the images separately?
Is this how Illustrator works?
I'm sure for Photoshop you don't have to do this?
Any info would be helpful.
Cheers
In Illustrator, if you go to menu File/Place, this will allow you to place other art files directly into your open illustrator document. If someone gives you that illustrator file and they do not give the "placed" files as well, when you open the illustrator document it will give you that error message because it cannot locate those files that were placed.
While using the "place" command in Illustrator, if the "link" check box is selected, anytime a placed file into illustrator gets edited and saved outside of illustrator, the edits made to that placed file will update the changes in Adobe Illustrator.
If the photos in their document are not embedded, you will need the images separately. Once you have the images, when you open the file on the new computer, you may need to manually associate the photos with each placeholder to make sure it renders properly.

creating a file upload function with titanium

I'm supposed to develop a mobile app for moodle using android on titanium studio. And I have been searching for days for any helpful article on how to get a file chooser dialog to work on android. Most of the tutes offer image upload but I need to upload .pdf and zip files from mobile. I have already tried fileChooserDialog() and folderChooseDialog() to no avail. Help please?
There isn't a file chooser out of the box, as apps usually send files to each other internally. You can roll your own using ListViews though easily..
Build a list of all the files you're interested in. (https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem.File-method-getDirectoryListing)
Loop through the list omitting any file types you don't want and build the list
When the user selects a file capture the click event and upload that file.
Style however you want..