Tiff to PDF Conversion

19 Jan 2009 In: programming

On a certain Friday evening, just as you’re about to head home for a relaxing weekend, you were informed that the client was expecting pdf files, while the images scanned were in tiff format. So, what can you do?

First option, we can download a free pdf writer (such as CutePDF) and painfully print each image to pdf format. Bear in mind that each image may contain thousands of pages, so the pain is multiplied by a thousand times!

Second option, look for a way to convert the files in batches.

I took the first option to see if our files were possible to be converted in the first place. OK, so this was possible and would provide me with a fallback plan.

Next, I took on the second option. Majority of the batch conversion programs need to be purchased. Since this extra work was not covered in the original project costing, no budget was available. So, I decided to look for an open source library and hack together a little program to do the batch conversion.

In the end, I used iTextSharp, and developed a program on MonoDevelop. The little program, known as TiffToPDF (duh!) is available here for free. Hope it’ll be useful for those who need it!

To run this program, you’ll need to install .Net 2.0 Framework. Next, you need to download the iTextSharp dll and place it in the same folder as TiffToPDF.exe.

Limitation: Doesn’t work for Tiffs with JPEG compression in them. This is due to exception in loading the bitmap, the same issue you get when you try to load them in MS Paint or Windows Viewer.

Sphere: Related Content

CakePHP 1.2 - Cancel button for form

12 Sep 2008 In: programming

I was looking for a solution to create cancel buttons for the add/edit views that allow user to return to the list view.

Ways I have tested but did not work too well:
1) Creating a button and redirect to list view using javascript (href.location). This generates an error of not having access to the specific directory.
2) Using history.back() or history.go(-1) to go back to previous page. This does not work well if user tries to add and fail validation multiple times, it would only return user to the previous page with those validation error messages and not to the list view.

I came up with this solution after much research and testing.

For example, in the add view, I have this:

<?php
echo $form->create('Post');
echo $form->input('title');
echo $form->input('body', array('rows' => '3'));
?>

echo $form->create('Post');
echo $form->input('title');
echo $form->input('body', array('rows' => '3'));
?>
<div class="button"><?php echo $form->submit('Save Post', array('div'=>false, 'name'=>'submit')); ?>
<?php echo $form->submit('Cancel', array('div'=>false, 'name'=>'cancel')); ?></div>
<?php echo $form->end(); ?>

And, in my controller add function, I have this:

if (array_key_exists('cancel', $this->params['form'])) {
$this->flash('Cancelled adding new post.','/posts');
}
else {
if (!empty($this->data)) {
if ($this->Post->save($this->data)) {
$this->flash('The Post has been saved.', '/posts');
}
}
}

With the above solution, we can also extend to further check for other button clicks and allow the controller to react accordingly.

Sphere: Related Content

Updated big guy walk cycle

10 Sep 2008 In: animation

Been busy looking for work and also practising on animation. Updated the last walk cycle.


Walk Cycle for the Big Guy - Update 2 from Stan Moong on Vimeo.

Credits: Model by CGNetworks, Rig by Stev Kalinowski

Sphere: Related Content

Big O’ Walk

5 Sep 2008 In: animation

Another walk cycle practice on the new character, Tahoro. No animation on the head yet, just trying to get the body right. I did very little hip translational movement, putting more on the hip and upper body rotation. As usual critics are welcomed.

Credits: Model from CGNetworks, rigged by Steven Kalinowski.


Walk Cycle for the Big Guy from Stan Moong on Vimeo.

Sphere: Related Content

Zen fight sequence.

3 Sep 2008 In: animation

Animated this short fight sequence between two ninjas. Fancy moves don’t always beat simple ones. Comments and critics are welcomed.

Credits: Model from CGNetworks, rigged by Dan Neufeldt.


Animation - Short Ninja fight sequence from Stan Moong on Vimeo.

Sphere: Related Content

Test animation cycle - Ninja

31 Aug 2008 In: animation

Well, been practising while waiting for any opportunity. Here’s the latest animation done using a Ninja character. Would love to do more with this character in the future.

Credits: Model from CGNetworks, rigged by Dan Neufeldt.


Animation Cycle - Ninja from Stan Moong on Vimeo.

Sphere: Related Content

My first demo reel

5 Aug 2008 In: demo reel

Just uploaded my very first demo reel, feeling really glad!

Check it out here.

Categories