Since I discovered this community I have found over and over solutions for my specific projects.
I want to say again that I am thankful to so many members that offer support and solutions. Thank you.
I let you know this in the beginning of this post because always as I am asking for support I have no idea about the limits of the request, hoping that I am not asking for nothing that it is hard or request to much from your resources.
I need a solution to save PDF files that are user generated.
To achieve this, I finished now with a solution not related to Tumult Hype, a solution that uses PhantomJS on a VPS server. Because of my limitations related to coding, I have this done with a support of a friend that knows PHP, but limited with JS.
Anyway, PhantomJS has a limitation: the PDF files are screenshots and in the final result the text it is just a picture …
I have searched the forum and I found it this post ( Save HTML file as PDF) but with no final answer, and also the solution from this post ( Is there a way to render a scene (or part of a scene) as an image file for sharing?), that is uses html2canvas and it is amazing.
What I need:
Searching the web I have found that may be a solution to export files using html2canvas and jsPDF to save not only images, but also PDF files.
Since my level of working with JS functions it is only by looking inside of the example that I found on this forum I would like to ask you to offer me support by combining the html2canvas and jsPDF in this solution, in order to export PDF ideally with selectable text or if it is to much work, than PDF only as a screenshot, also for the text.
html2canvas does as the name implies - takes an HTML DOM tree and converts to a canvas element. The problem is that canvas elements are bitmaps, so it will lose all the text information. Therefore the next step of using jsPDF is only being fed an image.
The demo 2 and demo 4 that you reference have explicit code that create text elements in the PDF.
Short of making your own system that walks the DOM and feeds everything to jsPDF (which would pretty much be a HTML browser!), I would look at running command line tools on your server that can do the conversion. There’s a lot out there that can do HTML to PDF directly. I haven’t used any myself but pandoc and wkhtmltopdf look pretty promising:
Thank you for your answer, @jonathan!
Having no right coding knowledge I took that sample as I wanted to be.
It is not the case for further hard work.
I wanted a solution that may be used with Tumult Hype so I can control the design and understand the flow.
Thank you very much for your support.
Thank you, again @jonathan !
I am coming back with some information just to be sure that I am understanding right.
HTML2canvas will always generate only bitmaps.
In order to use PDFjs it is necessary to build a browser like solution, based on a server-side function.
It may be possible to obtain a PDF file that create text elements based on PDF.js from Mozilla that may work at the level of the browser not server and may be integrated (created) inside (via) T. Hype?
I am asking this in order to know if it possible and eventually search / ask for paid support.
True (well, it makes a canvas element! but canvas is bitmap-backed, and what the examples were doing was then extracting that bitmap to feed into a PDF file).
My points above were to avoid using PDFjs; if you use a server-side solution there is no need for it.
Thank you very much for all information.
What I was trying to say about PDFjs from Mozilla it is if it may be used for my need that is to generated PDF documents from a Scene with text, that was created with Hype.
I understand that it is possible.
Now I understand that PDFjs it is just the viewer and not a generator.
Thank you very much!
jsPDF is a generator and PDF.js is a viewer. That’s not confusing at all.