I am looking for a way to convert a Tiff image into a png so modern browsers can render it. I have looked at Tiffus, but that doesn't look like it is being developed anymore. I have also tried writing a conversion program in C# and sending through JSIL, but that didn't work either. I have also tried using Tiff-js but the sample project isn't working. Does anyone know how to do this? I know I can do it in C#/server-side but we want to try to do it client side.
I ported LibTIFF to Javascript with Emscripten ( https://github.com/seikichi/tiff.js , demo: http://seikichi.github.io/tiff.js/basic.html)
Related
I need to convert a web page to a PDF because it won't print/look correct if it isn't converted. This is because the web page is so big, that as an HTML document the browser will try and split it into multiple pages (not just vertically, which is fine, but horizontally, which is bad). Though I originally planned to do this on the server side with Django, I realized that virtually all of the available libraries were written for python2, when I was using python 3.
So my only other option is client side. The only thing I could find on stackoverflow was this: convert HTML ( having Javascript ) to PDF using JavaScript, but all of the answers were in Java, not javascript.
I think the most ideal solution would be to change the style so that it was more printer friendly rather than making it into a pdf.
If it really does have to be a pdf created with Javascript, there's a library jsPDF http://parall.ax/products/jspdf out there for creating pdfs with Javascript. You would have to write something on your own to parse the page to create a matching pdf.
If you can use php, I recommend using dompdf, which was written specifically to translate webpages into pdfs, so there would be much less work involved there. https://github.com/dompdf/dompdf I've actually used this library, and it seems decent, though it doesn't support all css styling.
What are some of the best and quickest ways to format a JavaScript file.
I ask because I've downloaded a file called slides.min.jquery.js and I
would like to know how to change it so instead of being a one-liner it
is formatted properly.
I've got Aptana Studio but don't know how to open a JavaScript Project.
Any ideas? Thanks. Or else another tool will do.
Thanks.
You can use a tool like jsbeautifier to de-minify the compressed js.
Firefox has a plugin called deminifyer which can be used for this purpose as an offline solution.
From what i understand, This usually has to be done server side. However i have read that it is possible to point to the csv file in a .js file. This would be more useful to me as i am not messing around with server side code and stuff for this project and will be all on my local machine. I saw an article with example code to do this somewere however i can't locate that article atm. Anyone know how to do this?
To access any file from the system you have to use directX in IE or read up on how to use NPAPI for mozilla support.If you are willing to use HTML5, check out its filereader API here.
So guys I am working on a program to like download stuff using javascript. I hav written the following code:
function download()
{
alert("Hello");
var url='http://somesite/somefile.rar';
window.open(url,'Download');
}
The code is pretty easy, but is there some other way to download the file using javascript? Also having downloaded the file is there some way to store it locally in the location of our choice, like d-drive? I had come across the javascript file api while searching the web, is it any useful in my scenario? Please help.
Edit: Fixed code formatting
No, this isn't possible. It is up to the client where to save files, not you.
Through Javascript, you can only set the file name that you want, but would not be able to access the file system i.e. All the folders, etc..
Is there anyway to protect Processing.js sketch?
My company has a sketch that he wants to show to the world and in the mean time, he wants to ensure that no one can see his source code.
I've done protecting (partially) my javascript from browsers but the problem that I'm facing now is that firebug could reveal (XHR) my partially, protected source code.
So, I was wondering if I could obfuscate my source code. But would doing that cause processing.js to stop interpreting my source?
Is there anyway that I can use to protect my sketches?
No, obfuscation won't break your source code. Everything should work fine, just like when using normal source code.
Have you thought about doing it some other way? For example, after making a sketch, why not convert it to SVG or some other image format and show that instead to the world?
File a bug with us on dealing with your obfuscated code, it should parse fine:
http://processing-js.lighthouseapp.com/projects/41284-processingjs/overview
You can generate the sketch data on the server and upload it via ajax, sending most of the processed result directly to the browser. But there will always be some readable code.
It's not in javascript nature to be hide itself.