I need more options than third party pdf-generation libraries provide. Is it possible to generate a pdf file without using any js frameworks (server-side or client-side)?
I know there are lots of pdf-generation frameworks. I tried couple of them. But they are not enough for my project to be well optimized. I want to learn whether it's possible using pure js or not. If not, then which framework has the most options for aligning, working with columns, controlling page count etc.
I am kinda looking for a Microsoft Word like editing capability.
Also I'll be apprecited if you can teach me the logic behind the pdf-generation frameworks. I couldn't find any information about it.
UPDATE: For now, I figured out how Chrome's own pdf exporter works (Ctrl+P). And reorganized my code to build a well aligned, printable html document. Unfortunately it only works appropriately on chrome. But it works :). Now I am able to print whatever I wrote in html.
Related
I've played with a lot of php html to pdf converters and got really sick of it. I liked the most DOMpdf with which I've worked for 2 months. Yesterday I tested mPDF, it was basically the same but much faster.
The problem is that I have an HTML file with internal CSS and external images, and if I use the advanced stuff, things like float, overflow, round-corners, shadows etc, then things just fall apart. Is there ANY way just to convert HTML and CSS into PDFs without any hassle and for free?
I don't even care how anymore. It can be JavaScript conversion. It can be an external site conversion, it can even be some kind of software (if that is possible in my hosting), a browser plugin (Not CutePDF, I need costum height adn width controls), a plugin for any CMS. as long as it's not over complicated and I don't have to waste time on re engineering the design
Any solutions for any kind of design with HTML + CSS so that I don't have to censored around with the design?
I came across this older post while looking for something else. But have you tried simply putting your HTML file onto google Drive, saving it as a Google 'doc', and then using the 'File->Save As->PDF ? It works fine for me. You'll end up with your original HTML file, a Google Doc version, and a PDF version. There might even be an API for this now, I don't know.
I am looking for a solution to generate pdf from (html + css + javascript) using AngularJs.
I tested two solutions:
jsPDF (it does not take the css)
Shrimp (based on Ruby)
which do not work for me.
How can I do it?
After all this, I discovered the excellent PhantomJS.
The binary was easily installed on the server with no additional dependencies required, and came with a great deal of example code, including a working ‘print to PDF’ function out-of-the-box. With some minor tweaks, we customized the script for our use case, and had a PDF copy of our webpages in minutes. PhantomJS has been around since 2011 and is used by a variety of open source products, listed on their websit
I have a node web app that needs to convert a docx file into pdf (using client side resources only and no plugins). I've found a possible solution by converting my docx into HTML using docxjs and then HTML to PDF using jspdf (docx->HTML->PDF).
This solution could make it but I encountered several issues especially with rendering. I know that docxjs doesn't keep the same rendering in HTML as the docx file so it is a problem...
So my question is do you know any free module/solution that could directly do the job without going through HTML (I'm open to odt as a source as well)? If not, what would you advise me to do?
Thanks
As you already know there is no ready-to-use and open libs for this.. You just can't get good results with available variants. My suggesition is:
Use third party API. Like https://market.mashape.com/convertapi/word2pdf-1#!documentation
Create your own service for this purpose. If you have such ability, I suggest to create a small server on node.js (I bet you know how to do this). You can use Libreoffice as a good converter with good render quality like this:
libreoffice -headless -invisible -convert-to pdf {$file_name} -outdir /www-disk/
Don't forget that this is usually takes a lot of time, do not block the request-answer flow: use separate process for each convert operation.
And the last thing. Libreoffice is not very lightweight but it has good quality. You can also find notable unoconv tool.
As of January 2019, there is docx-wasm, which works in node and performs the conversion locally where node is installed. Proprietary but freemium.
It appears that even after three years ncohen had not found an answer. It was also unclear if it had to be a free (as in dollars) solution.
The original requirements were:
using client side resources only and no plugins
Do you mean you don't want server side conversion? Right, I would like my app to be totally autonomous.
Since all the other answers/comments only offered server side component solutions, which the author clearly stated was not what they wanted, here is a proposed answer.
The company I work for has had this solution for a few years now, that can convert DOCX (not odt yet) files to PDF completely in the browser, with no server side component required. This currently uses either asm.js/PNaCl/WASM depending on the exact browser being used.
https://www.pdftron.com/samples/web/samples/viewing/viewing/
Open an office file using the demo above, and you will see no server communication. Everything is done client side. This demo works on mobile browsers also.
So I'm working on a just for fun project to get practice using HTML/CSS/Javascript.
I'm using Aptana to write all my code and it is currently set up to run and work in a browser (obviously) it's a text adventure game.
It would be really cool though to be able to compile the code into an executable file that runs in its own window, not in a browser.
Is this something relatively easy to accomplish?
Thanks in advance for any help! :)
FF and Chrome provide a function to run a custom website in an app mode. That means no menubars, no addressbar and a complete window for the website. Maybe this is already what you are looking for.
http://www.rarst.net/software/dedicated-web-app-window/
https://superuser.com/questions/33548/starting-google-chrome-in-application-mode
https://superuser.com/questions/171235/does-internet-explorer-have-something-equivalent-to-chromes-app-mode
But if you are interested in compiled code for speeding up your game, this is not the way to achieve this.
For Windows as OS
see http://www.autoitscript.com/autoit3/docs/libfunctions/_IECreateEmbedded.htm
AutoIt is a scripting language for basically everything (with automation). SciTE is the editor to go.
In the example of the _IECreateEmbedded function, just change:
_IENavigate($oIE, "http://www.autoitscript.com")
to
_IENavigate($oIE, "file://.../thegame.html")
Very simple, you just have to copy-paste it and build it - you can even build it Online: AutoIt Online Compiler
There are many different ways you can acheive this.
If you're only targeting windows machines, then creating a HTA would be the simplest approach.
The modification to the structure of your existing code would be minimal, its essentially changing the file type and adding an extra couple of tags in. If you wanted a single file, instead of an exe and any resources (images etc) that you use you would have to base64 encode your images, and insert external scripts into the main page.
for information about embedding images and icons into a hta: http://www.john-am.com/2010/07/building-a-self-contained-hta-with-embedded-images-and-icons/
You could also use AppJS, node-webkit or similar type projects, but they would add around 30MB of stuff thats not being used.
I'd like to use WMD with PHP Markdown Extra. I don't need any new buttons in the editor, but I need the live preview to reflect the use of the extra markdown features, most notably tables.
Is there a WMD configuration option to use a preview generated server-side? Similar to the previewParserPath value for MarkItUp? If not, what are my other options?
I'm working on a cross-language markdown implementation here: http://code.google.com/p/mdown/
It's a derivative of showdown, which is the Markdown implementation used in wmd.
It's currently 99% working in PHP and javascript, with one small non-critical bug in the javascript version.
I intend to add the features from PHP Markdown Extra ASAP, so they'll be available in both the javascript and PHP versions. In fact this was the whole reason I started this project...
So, it's not really an answer I guess, but if you're patient this should be ready by some time next week. Or, if you want to try adding it yourself, I can give you access to the project and you can take a shot at it.