I want to develope a app like camScaner. In which user can scan any type of file like image, pdf etc and then convert that file from word to pdf. So I want to aske that, is there any way to convert docs file to pdf in react-native?
You can use libreoffice convert for achieve the task
Link >> https://www.npmjs.com/package/libreoffice-convert
Also there is one more library awesome-unoconv which will provide you the same thing and will convert word to pdf
Link >> https://www.npmjs.com/package/awesome-unoconv
Related
I'm using maker.js from microsoft to create svgs and maker.js also allow to export the models to dxf string.
I'm able to get dxf string from it.
I want to make dxf file from dxf string and save in user desired location or default download location.
Question
How do I create a file and write in it using a string and save it with extension .dxf using javascript.
Generally a user has to initiate a download, easiest way I'm aware of is a href to a data url. In React you can render that link as:
<a
download="result.dxf"
href={`data:application/octet-stream;base64,${btoa(dxfString)}`}
>
Download your DXF
</a>
Where dxfString is a the value returned by makerjs.
Demo of this code in production
HTML only version in jsfiddle
Depending on your framework you'll need a different syntax for changing href of a link. btoa is a standard function in all modern browsers.
I'm using NodeJS to do an app that finds and replaces a text in a pdf. I have found some approaches:
Using some npm package, like pdfReader, that converts pdf to json. So I get the text and replaces it with what I want. The problem it's convert the output back to pdf.
The possible solution for the first item it's to convert the PDF to HTML, edit the HTML and convert it back to pdf. But most of the tutorials using NodeJS it's about convert HTML to PDF, not PDF to HTML.
Any solutions for this problem?
Update
I ended up using PDFKit to create the pdf files that i need. In my case, this solution don't to cover all the possibles. But if you have to find a word and replace it in an unpredictable pdf file, maybe this problem has no solution in nodeJS. The PDFKit lib has an open issue for this feature.
Look at this approach how to export json data to pdf file with specify format with Nodejs?. Basically uses your idea. Convert PDF to JSON and then render the JSON in html, then convert the HTML to pdf.
(1) Is there a way to search for texts in a pdf file and go to that location in the pdf file using Python?
(2) Is there a way to highlight a text in a pdf file and that text get extracted, using Python?
I tried using Javascript pdf.js, which actually worked but I want to try Python. Any help would be appreciated. Thanks!
For searching for text within a PDF file you can use PyMuPDF or pdfminer. PyMuPDF would also let you create a PDF viewer and highlight the text if that's what you have in mind.
I have a successfully running script that loads Word files from SharePoint and inserts them into Word 2017 (Office 365 Word local client, not online)
The current scripts reads up the files using Ajax and extracts the base64 file and uses
body.insertFileFromBase64(myBase64, end)
I now need to extend the functionality to support Word 2013 (i.e. use the Office.js instead of the Word JavaScript api). So the code has changed to
Office.context.document.setSelectedDataAsync(file, someCoercionType)
I hoped to be able to use a variant of
Office.context.document.setSelectedDataAsync(myBase64, {coercionType: Office.CoercionType.Ooxml}, function (
But I get an error back "The Format of the specified data object is invalid", which is correct enough as the Office API assumes a base64 file is an image.
Is it possible to convert the Base64 file to XML in JavaScript? (Elsewhere in my code I unzip the docx and extract bookmarks, but only from document.xml which lacks all formatting and images, footers etc.)
Base64 is simply an binary encoding and blissfully unaware of the underlying content type. So if you're source content was OOXML, decoding it would give you that OOXML back. What you cannot do is type conversion. For example, a Base64 encoded JPEG can not be decoded directly into a BMP. To do that you would need to first decode and then convert from JPEG to BMP using some other tool.
If you're seeking to manipulate or extract content an existing document, you may want to look at Aspose.Words. Aspose provides tools that allow you to programmatically work with Word documents (they have similar tools for a flew of other file types as well). Using this, you may be able to extract the OOXML you're looking for so you can then insert it into Word using Office.js.
At the moment, the only Coercion Type that accepts Base64 encoded content is Office.CoercionType.Image.
I have created a Rich Text Editor in UIWebview. My requirement is to save this text in .doc word file. How to achieve this. I am getting html content by using
NSString *strWebText = [webView stringByEvaluatingJavaScriptFromString:#"document.body.innerHTML"];
Now how can I proceed further to convert it in .doc format? Or is there any javascript function to convert text or save text to .doc file?
Microsoft Word can open a .doc file that is really .html and will open it as such. There isnt anyway for you to easily convert your html to a binary .doc file without significant code or the intervention of a server.
if you create a html file from a word doc, you will see the html produced. You will find certain headers at the top copy these in your html and word should open it correctly.
iOS does not have any built-in support for editing rich text or converting between formats. You'll have to find a library or write it yourself.
you can use :--
[strWebText writeToFile:#"Data.doc" atomically:YES encoding:NSUnicodeStringEncoding error:&error];