Export current rendered view/template as a PDF with Nativescript-VueJS - javascript

Using NativeScript + VueJS, I'm trying to find a way to take a dynamic template that's rendered based on props and route data, and tap a button to save the "view" as a PDF to the filesystem.
I found this tutorial here which gives me a start: https://medium.com/#kumarandena/pdf-generation-in-nativescript-using-javascript-libraries-864ecf4e9a3a
This generates a Base64 which you then copy to clipboard and open in a browser. In iOS for example if I choose to save the page as a file it's just unknown.pdf. So my goal is to reference an html element, like a div, and save all the contents exactly as they appear into a folder of my choice in the native file system.
There's little to find on this so wondering if someone has accomplished this.

I use domtoimage to convert any dom element to an image, and it works well. Then you can probably insert that image to a pdf using jsPDF or pdfMake.
I see in the pdfMake playground that you can insert an image with a dataurl format.

Related

How to add a file inside of an excel spreadsheet?

I'm currently using node-xlsx library to generate an excel file.
I'd like to add a file, specifically an image object, inside of the excel I'm creating, so that the user can just double click on the cell to open the image.
The alternative way would be to produce an excel and an external jpg file and put an hyperlink to it into the cell, but I think the first idea would be more user friendly...but I can't find a way to do that!
Can you help me finding out if it is even possible with node-xlsx or an equivalent library?

I have downloaded a text file. Instead of downloading I want to display it in a html page using javascript

I try to convert a pdf as base64 string. I converted it and saving it to text file. Iam able to download the text file. But i dont want to download it instead of download it i want to display it in a html page. While clicking that text file i should be able to view the content of the text file. Is there any possible way to do it in javascript.
I have attached the below Link
https://codesandbox.io/s/nervous-flower-nxmtw?from-embed
You can use a iframe and put the text file link to src
Note* - the above solution is with the limited information i have understood .

How to create pdf export of a part of the current page on the client side

I try to understand if I could use PhantomJS (or any similar js library) in my web application (in a javascript function called when "ExportToPdf button is hit) to create pdf export of a part of the user's current page, for example the contents of a div, but with its current styles.
And I need it to be made on client side.
I see over my searches that phantomJS is used as a tool (console app executable), but could I utilize it the way I need it?
Maybe in combination with jsPDF or some similar js library...
Or if you have any other solution to suggest... I already have tried jsPDF alone and it does not get any styles at all (all bootstrap class elements are missing). Also I tried html2canvas+jsPDF to get image of the desired div contents and put it on a pdf doc, but this does not seem to get all the height of the div (only the part that is viewable in browser gets exported)

Generate pdf from HTML and SVG

I have some SVG element in my HTML page with some HTML controls. I want to export all in a pdf. The export need to be "correct", I can't, for example, create a picture and create a pdf from it. And the html text need to keep this format, it have to stay selectionnable.
I saw jspdf but it seems hard with SVGs.
So, have you got an idea to do this?
Just for information I work with Phonegap / Angular js on mobile platforms.

Use CKEditor image plugin without the HTML editor

I'd like to use CKEditor's Image plug-in separately from the rest of CKEditor.
Basically I'm creating a simple tool to edit webpages. Some parts of the webpage will be HTML and thus require the full CKEditor. But some parts will be images, and I don't need the full HTML editor, just the Image plug-in.
Is this possible to do, and what would be the "cleanest" way to do so?
CKEditor doesn't provide an image browser by itself, so you must research how to use the file browser component that you have picked by itself.
If you're using CKFinder look at the standalone.html sample, like shown in the "enhancing html forms" here: http://ckfinder.com/demo

Categories