React-Native file viewer - react-native

Hello fellow developers,
I am looking for react native code for doc,pdf,ppt and xls viewer in mobile. I want to read these files from assets folder,local storage and also from url link.
Can someone please share the code for the above requirement.please
Thanks in advance
when I tried the code from this link: https://www.npmjs.com/package/react-native-doc-viewer

You need a semicolon before the filename (after the base64) else the object is not complete
Like
//snip
base64: "{BASE64 STRING}",
filename: "sample",
//snip

Related

Uploading pdf file with cypress

I need to create automatic test that as part of the flow i need to upload pdf file in my main application.
But i didnt find a way to do that...
Thanks in advance !
Uploading file works in Cypress when target "input" element is of "type="file"
cy.get("#myFile").selectFile("cypress/fixtures/dummy.pdf")
where ID of the input of type file= #myFile" and path of pdf file="cypress/fixtures/dummy.pdf"
Please refer to Cypress Docs: https://docs.cypress.io/api/commands/selectfile

Print a pdf downloaded through a webservice in Flutter / Dart

I'm working with Flutter.
I have a pdf document that I download from a webservice.
The http body response of this pdf sent by http package is typed as Uint8List.
Then, I would like to print it with printing which is working with pdf package.
So I need an instance of a PdfDocument from this class.
Is there a way that I can convert this Uint8List to pdf ? I tried some other dart packages, but they didn't answer my needs because I need to print pdf, not just view them.
I also looked with flutter_downloader in order to simply get pdf file without bothering myself with Uint8List, but it seems the package is not working at the moment: https://github.com/fluttercommunity/flutter_downloader/issues/132
Thank you very much for answering.
Use:
var data = await getThePdfData(); // obtain the Uint8List
Printing.sharePdf(bytes: data);

Play sound with Oboe with .obb file

Hello sorry I'm begginer.
I don't have my sound files in my assets folder but in my .obb
I'm using the RythmGame sample who is using only assets folder.
I'm trying to use DataSound but only AAssetDataSource is used in my sample for create a DataSound.
I look at Asset and NDKExtractor for the decode function, but can only be use with an AAsset from an AssetManager...
How can I play sound from an .obb with Oboe ?
Can someone help me with that problem ?
Thanks
You should be able to do this by getting the path to your expansion file and passing that through JNI to your native code, opening it as a normal file object and passing the contents to the extractor.
You're right about the NDKExtractor::decode methods - they take an AAsset *, however it should be pretty easy to update them to take the file descriptor from your open file instead.

React Native - Create and Export/Download PDF File

I'm making a project in React Native that creates a table with some data, and I need to create a pdf with that table and be able to download/export that pdf.
Currently i'm using https://github.com/christopherdro/react-native-html-to-pdf, but its downloading to cache directory, even if i change to docs.
I was searching and some people say that u need to use file manager to download a pdf.
Can someone help me?
From docs, you have to specify "Documents" directory if you want it to be saved on Documents dir of ios/android.
async createPDF() {
let options = {
html: '<table><tr><th>Firstname</th><th>Lastname</th></tr></table>',
fileName: 'tableTest',
directory: 'Documents',
};
let file = await RNHTMLtoPDF.convert(options)
alert(file.filePath);
}
Since you are creating this table in your react native code, you don't need to download anything from anywhere. Cache directory is your phone's cache directory, so I can't understand from where you want to download the pdf.

Render HTML or GSP as a PDF and save it on server

I have an html template which I need to render as a .PDF and then save that pdf file on server. I'm using "rendering" plugin of grails. I'm able to render file as PDF but I don't understand how to save it on server location and not on user's system. Can anybody please help me ?
The pdfRenderingService provided by the plugin allows you to call render and get back an OutputStream. Using that output stream you can write that to a file on your server. The documentation explains the basics of using the service.
Your code may look something like this:
new File("report.pdf").withOutputStream { outputStream ->
outputStream << pdfRenderingService.render(template: '/report/report', model: [serial: 12345])
}
Well, actually I changed my plugin. Got Wkhtmltopdf plugin of grails more helpful. you can find it here --
https://github.com/quorak/grails-wkhtmltopdf
Also instructions regarding using this plugin you can find on the same link or here --
[https://github.com/quorak/grails-wkhtmltopdf]
Using this you can get "bytes" which you can write to file system.