Saturday, April 9, 2011

Saving EPS files from Powerpoint

The newer versions of Microsoft Powerpoint (2007+) offer a simple and intuitive interface to quickly create nice illustrations. It would be really nice if you could use this to create diagrams for paper submissions to conferences/journals.
If you want to import pptx diagrams into your papers, typically, the best way is to export as pdf (Microsoft has an export to pdf plugin). Now you could simply import the pdf images in your Latex file, and things work pretty well.
The only hitch is that many conference templates enforce eps images. Now most paths that convert pptx->pdf->eps completely mess up the image. Sometimes the pdf may be converted into a Huge bitmap in the eps file. We certainly don't want that. Here is a technique that you can use to directly convert pptx drawings to eps, while keeping the vector format. No more "Yuck! Bitmap..." comments from your advisor :) ... and you don't have to tell Microsoft Haters that you used Powerpoint :) and that you converted it to eps using tools that come by default with Windows ;)

Anyway, before I begin, here are the places from where I picked up this info (everything is just a web-search away):
http://people.csail.mit.edu/dalleyg/faqs/20010425.html
http://www.sketchpad.net/postscript-printer-winxp-1.htm

Note: I am using Win7 & Office 2010, so some things may be a bit different in other versions.

Now the first step is to create an EPS File Printer. (Yes you can do that)
Go to 'Control Panel'->'Devices and Printers'->[Right Click]->'Add a Printer'
Click 'Add a local printer'.
Choose 'Use an existing port'->'FILE: Print to File'
Pick some printer that has a 'PS' suffix to it.
Now this may take some trial and error to find a color printer with decent number of options.


You can print a test page and check if things are working now. (Just save the page as a .eps file). To view this, you may need to install GhostScript & GhostView on Windows. Linux should have this by default.

Now to prepare the PPT diagram for printing:
Create a blank presentation.
Select 'Design' -> 'Slide Orientation' -> 'Portrait'
(This is the only limitation I came across. In Landscape mode, the EPS printer rotates the image through 270 degrees)
Select 'Design' -> 'Page Setup'
Setup the page dimensions here (This should be the boundary of your diagram)

Now copy-paste the actual drawing into this slide from wherever you created it.
(The reason for this is, if you draw first and then rescale the page size, it will stretch the diagram. Maybe there is a workaround for this.)

Now select 'Print', and pick the PS printer from the list.
Select 'Printer Properties'->'Advanced'

Setup the PostScript options as shown in this screenshot:

The Postscript output option should be EPS.
Postscript language level be 1 (could be higher I suppose, but this is safer)
TrueType font download options: Outline (This converts fonts to curves I guess. Play around with other options if you want, but stay away from 'Bitmap' of course).

As shown in the next image, set the Paper Size to 'Postscript custom page size'. Keep this the same as your Slide dimensions, because this will be the size of the CropBox in the EPS file.


Now we are all set. Just click 'Print' and save the file with a .eps extension.
GhostView correctly rendered this file for me, and the file size was reasonable.

Note however, that eps is limited in its ability to handle transparency (i think there is no transparency whatsoever), and gradients, so try to use solid colors in the drawings.

Let me know how this goes for you :)

Thursday, April 7, 2011

How to use Windows Phone 7 Marketplace in India

Having recently 'procured' a HTC HD7, I was hoping to post a review of some sort on this blog. But none of my review plans (for this phone, the PS3 and a few PC games) seem to materialize in any reasonable time frame, so here are some tricks for anyone finding themselves in the less than desirable position of owning a Windows Phone 7 device in India.

[ Feel free to skip over this next part. Just scroll over to the 'End of Rant' below ]

Well, here is the fundamental problem: Smartphones are not much if you can't run applications on them. And Microsoft decided that it would be a very prudent move to sell WP7 phones in India, without any app-store support. (FYI, Microsoft has screwed over users in many countries like this, so this is certainly not a special case).

Here is how things typically play out:
Step1: You shell out 25,000/- for a WP7 of your choice.
Step2: You start the phone, and it tells you to sign in with your 'Live ID'. You can create one if you don't have it. I have a Hotmail account since the Stone age, and decided to use that.
Step3: You decide you want some apps, and click on the Marketplace icon. You are greeted with a message that says 'Marketplace is not yet available in your country/region'
Step4: Ah! But we are clever, no? Simply have to change the country to 'USA'. The country is tied to your Live ID. Once you create it, you can't change the country. So, we go and create a new Live ID. I, for instance, am a retired Sith Lord living a peaceful life in Kansas...
Step5: Oops. You can't change the first Live ID that you used in the phone. It is now inexorably tied to the phone. What do we do now?
Step6: Factory Reset the phone. This will clear everything (all photos,videos,music,downloaded apps, mail, settings...the whole shebang) And how do we do that? Quite intuitive really. Go to Settings -> about -> reset your phone. ('About'?!! seriously Microsoft??)
Step7: Now you enter your new Live ID details. This works great on your phone, except that you can't really buy any apps because everything is listed in Dollars, and Microsoft does not support credit cards outside your region. Now all you need is an obliging chap with an American credit card. Yeah right...

[ End of Rant ]

Now for the good news: There actually IS an app-store for India, where everything is listed in INR and leprechauns stash heaps of gold at the ends of rainbows.
The problem is that the Phone does not seem to acknowledge its existence. The only way to access this store is through Zune Software (MS equivalent of iTunes).
You can login on Zune, using your India based Live ID, and it will (sometimes) show you the Marketplace.
I say Sometimes, because Zune has this nasty habit of setting some registry entries that removes India (IN) from the list of valid Marketplace regions. There is a nice hack described HERE, to overcome it.

A short summary of the registry tweak:
Go to this registry key: HKEY_CURRENT_USER\Software\Microsoft\Zune\Features

Here you will see the codes of the following countries in 3 entries:
AT,AU,BE,CA,CH,DE,ES,FR,GB,IE,IT,MX,NL,NZ,SG,US

Just add IN to all the entries, so they become: AT,AU,BE,CA,CH,DE,ES,FR,GB,IE,IT,MX,NL,NZ,SG,US,IN

These guys have even made a helpful reg file: Here

Now for my trick: When you purchase/download apps from Zune Marketplace, they don't always turn up on your phone. Infact, the phone starts downloading these apps in its download manager, and sometimes the downloads stop due to network errors or whatever. Typically, you would simply resume the download by going to the Marketplace through your phone. But you can't open the official Marketplace app on your phone...

The trick is to simply install a 3rd party marketplace app through Zune (there are 3 or 4 marketplace search apps which should install fairly quickly). HTC phones come preloaded with 'HTC Hub' from which you can access some apps. Just find an app listed on one of these marketplace apps, download that app from Zune Software on your PC (while your phone is connected of course), and now you should see a 'check install' button on that app, in your 3rd party marketplace app on the phone.
Clicking this takes you to the Download manager, where you can resume/pause/cancel (oh wait, no you can't cancel downloads... another brilliant feature).

Anyway, if someone knows a better way to get the Marketplace working properly in India, do let me know...