Showing posts with label printer. Show all posts
Showing posts with label printer. Show all posts

Thursday, May 3, 2012

Using CSS to Make Your HTML Page Printer Friendly

Besides for styling for regular media (such as screen / pc monitor), css can also be used to make the web layout suitable for printing.
Perhaps you have a web page which has logo, menu, navigation, videos, and other things on it. Also there is a table or other information which you actually need. You would not want those irrelevant elements cluttering all over when you print it, right?

To solve it, simple use specific stylesheet for printing purpose and define it for "print" media. Here is an example of using external stylesheet for "print" media:


Next step is to eliminate those unnecessary elements using display: none. Here's an example:
div#menu {
display: none;
}

Now, as a bonus, I found out a way to make the default printing orientation as landscape. Here's it is:

@page {
size: landscape;
}

Another interesting thing that I found during my work is that !important rule defined in other css for any other media other than "print" will also effects the "print" media layout. I did not expect that, since I assume that !important rules defined for "screen" media, for example, would only effect that particular media. So, make sure you override the !important rule in the "print" css.



Sunday, July 3, 2011

Virtual LTP1 for USB Printer

Another interesting day. I faced a typical trouble when running old legacy software on new hardware. This time the issue is with the printing. The legacy software requires lpt1 connection to do the printing, which the new hardware does not have.
This should be simple if there is a configuration menu for choosing the appropriate printer, unfortunately there is not.
Another thing that makes it a little bit complicated is, it uses raw ESC command, instead of using the printer driver to print.
In this case, somehow I need to make the legacy software sees and uses lpt1.

Now, the solution is to add the printer, which uses USB, so it will work correctly. Now, the trick is to use a generic text printer as the driver instead of the actual printer's driver. That solved the raw ESC command.
Nex step, share the printer. Then, redirect ltp1 to use the usb connected printed configured previously. To do that, go to command prompt and type the following command:
c:\> net use lpt1: "\\computer_ip\\name_of_the_shared_printer" /persistent:yes

At this point, the lpt1 is available for the legacy software to use.

Monday, June 21, 2010

Canon Pixma MP145

Here's the steps:

Download the following from canon website:
1. cnijfilter-common_2.80-1_i386.deb
2. cnijfilter-mp140series_2.80-1_i386.deb

There will be problem related with dependency if you want to install them directly (my case is with Ubuntu 10.04).
Both packages depend on libcupsys2, while in my version of Ubuntu it should be libcups2.

So, next step is to modify those packages to use the proper package dependency.

$ mkdir modified-deb
$ dpkg -x cnijfilter-common_2.80-1_i386.deb modified-deb/cnijfilter-common_2.80-1_i386
$ dpkg -e cnijfilter-common_2.80-1_i386.deb modified-deb/cnijfilter-common_2.80-1_i386/DEBIAN

after that, then edit modified-deb/cnijfilter-common_2.80-1_i386/DEBIAN/control and replace licupsys2 with libcups2.

Repackage the updated version:
$ cd modified-deb
$ dpkg -b cnijfilter-common_2.80-1_i386

Do the same thing with the other package, cnijfilter-mp140series_2.80-1_i386.deb.
Finally, install both packages, and you are done.