Name Mon Lu

Love jQuery/CSS

Blog about Webdev

Twitter supawaza

RSS Twitter Flickr

What I am up to:


Posts Tagged ‘javascript’

Ver­sion in this arti­cle: jQuery 1.3.2 / CSV2Table 0.03-b-2.9

Lately I started to like CSV (Com­mon Sep­a­rated Val­ues) more and more com­par­ing to XML.XML is a pain to setup even as enter­ing data, then grab­bing the data requires Einstein’s brain plus 3 sleep­less and hair-pulling days of cod­ing… okay, I maybe exag­ger­ated a bit, but that’s how I feel about XML. My first encounter with CSV was InDe­sign, in there, you can import a bunch of data and gen­er­ates PDF like Word’s Mail Merge fea­ture. Then one day, some­one asked me if I can find a bet­ter and eas­ier way to help the non web peo­ple to main­tain a site. I started out with search terms like “jQuery read text files” or some­thing like that, one of the results returned as using CSV and there is a plu­gin called CSV2Table in the jQuery Plu­g­ins web­site by Toshiro Taka­hashi writ­ten ear­lier this year. Test­ing… (more…)

This was one of the old posts that got cor­rupted when I did a rein­stall of WP 2.8.1.  Since this script is pretty handy, so I’m re-posting it.

This scripts worked in Acro­bat 8 & 9 Pro. Instead of of man­u­ally extract­ing all the pages, and then man­u­ally opti­mize them, this script can ease the process. To access the Batch Pro­cess­ing menu: Advanced -> Doc­u­ment Pro­cess­ing -> Batch Pro­cess­ing. The screen shot below shows where and how to add the script:

Acrobat Batch Extactions

Then add the fol­low­ing script into the “Javascript Editor”:

var filename = this.documentFileName.replace(".pdf","");
try{ for(var i = 0; i<this.numPages; i++)
    var num = i+1;
    this.extractPages({ nStart: i; });
    cPath: filename+"_"+num+".pdf"});
}cath (e){ console.println {"Aborted: " + e) }

Saves a lot of time if you have a lot of files to extract and need to opti­mized the files using cus­tom settings.

Quickie note, a very sim­ple script to pick a ran­dom num­ber between 1–5, instead of 0–4

	var rand = Math.floor(Math.random()*5);
	if(rand &gt; 0){
		rand = rand+1;
		alert(rand);
	} else {
		rand = 1;
		alert(rand);
	}