« Older Entries Newer Entries » Subscribe to Latest Posts

7 Apr 2009

Tons of Free Music from Amazon.com

Posted by khk. No Comments

Amazon.com has a bunch of indie music samplers available for free (’til the end of the month). There is good music, there is fantastic music, and there is one song that’s just so out of this world (The Conchord’s Hurt Feelings – if you love he show, you need that song 🙂

Just click on the add below:

30 Mar 2009

Splitting PDF Pages

Posted by khk. 32 Comments

Update:

Please visit the same post on my business site. The comments are closed here, so if you want to comment, you have to head over to http://khkonsulting.com/2009/03/splitting-pdf-pages/

No, this is not about my patent pending idea of a sheet splitter that turns duplex documents into simplex documents… This post is about a problem that comes up every now and then: When you scan a book or a magazine, chances are that you end up with two physical pages on your scanned image, and your document looks something like this:

JoinedPages.png

Pages one and two are on the same scan, three and four are, and five and six and so on. How can we split such a combined page into it’s two parts? There are of course different solutions to this problem, some more complicated than others, some producing better results than others. The most straight forward approach would be to write an Acrobat plug-in or a standalone application (e.g. using the iText library) that takes the source page, determines what needs to be copied to the new page that should represent the left half of the original page, and then just copy those page elements. With a scanned source document, this would potentially mean that the scanned image needs to be cropped and placed on the target page. Sounds complicated, and it is complicated. Is there an easier way to accomplish the same results? [More after the jump] Read the rest of this entry »

29 Mar 2009

My Moo Business Cards

Posted by khk. 5 Comments

I needed business cards. The usual recommendation is to go with one of the free offers (e.g. VistaPrint or HP), but that’s not me…

I wanted cards that would not only show off some of my more creative side, but also cards that would stick out – figuratively and literally.

In the past, I’ve had the Moo mini cards, but they don’t make for good business cards because of the restricted space on them. I needed to fit more information on a card. Moo also makes business cards so I started to collect a few images that I wanted on the backs of my cards, and worked on the design.

When I received the cards in the mail, I was impressed with the print, but also the paper quality. The cards stick out for two reasons: They look great, and they are of a different size than the regular US business cards: They are a little wider, but not as tall (I use them in portrait orientation).

Take a look:

Moo Business Cards

Moo Business Cards

Because I don’t want late night calls from people I don’t know, I’ve removed part of my phone numbers, and my street address. The actual cards of course do contain that information.

Moo Business Cards

All the images that I’ve used are in my Moo set on Flickr.

28 Mar 2009

Digging Deep into History – My First Tweet

Posted by khk. 1 Comment

I’ve been using Twitter more over the last few weeks – this is pretty obvious when you take a look at the graph from TwitterCounter.com:

TwitterCounter.png

Once I started to tweet more, my follower count went up.

While playing around with different Twitter tools, I came across MyTweet16.com, which allows you to display the first 16 tweets of any Twitter user. I of course was curious about what I had to say when I first signed up for my account.

What I found was pretty interesting: For my very first tweet, I did not use any of the “normal” ways to use Twitter: It was not the web interface or any of the established Twitter clients – instead, I used a program that I wrote myself. I completely forgot about that. Who else can say that they tweeted first with something they created (besides Biz Stone and Jack Dorsey, the founders of Twitter)?

I used the book Creating Mashups with Adobe Flex and AIR (Friends of Ed Abobe Learning Library) to get some exposure to Flex, and the first few examples in the book are about using the Twitter API.

So, without any further ado, here is my first tweet (copy&pasted from MyTweet16.com:

Playing with Flex for the first time (that's how I twittered this). 12:33 PM Jun 3rd 2008

I actually singed up for Twitter just to use these examples.

Please follow me on Twitter.

23 Mar 2009

More PDF Tools

Posted by khk. 1 Comment

As promised, here are some PDF related tools that I don’t use, but either have used, have played with, or just know about how good they are. These are the tools that I recommend when somebody asks me “what would you use to do XYZ?”.

PrimoPDF

The best free PDF generator. Just see my previous blog post. If you need a PDF generator, download that program.

NitroPDF

From the friendly people who bring you PrimoPDF. This is a package that competes with Acrobat. It can edit PDFs, create forms, fill forms, create PDFs, … And it’s cheaper than Acrobat. There is a free eval version available. Download it, play with it and see if it covers all your PDF needs. If not, there is always Acrobat. An upcoming release will have OCR support (after release 6).

PDF Enhancer

The PDF Enhancer is a very powerful tool to “enhance” PDFs. Enhancement in this case can mean a lot of different things: Make them smaller, fix common PDF problems, embed fonts, add or modify color management information, … There are different versions available, even a server version. Apago also has a free eval version that you can download to see if it fits your needs.

Enfocus PitStop Professional

PitStop is a preflight tool that I used in my previous job. In addition to preflight capabilities, it also implements the Enfocus Certified PDF Workflow that allows a PDF file to contain an audit trail of all operations that were performed on it. In addition to PitStop Professional, Enfocus also offers the PitStop server, which can do anything Pitstop Professional can do in an automated fashion.

Quite Imposing Plus

This is simply the best imposition tool for PDFs. If you need to impose a PDF, Quite Imposing Plus can do it. It is not the easiest tool to work with. One of the best features of it is that you can create sample PDF files with page numbers to figure out how exactly an imposition scheme needs to be set up. Once you’ve figured that out, you can just re-run the same process again on your real document.

PDFLib

PDFLib is a great tool to programatically create PDF files. I’ve used an older version a few years ago. I’ve followed the development of the library over the years, and I still can recommend it as an alternative to iText.

21 Mar 2009

I Love My Mozy! (Updated)

Posted by khk. No Comments

It’s this time of the year again… No, I don’t mean tax time, it’s time to renew my Mozy subscription. That of course requires that I rethink my commitment: Do I want to subscribe to the service for another year? Do I get my money’s worth out of my subscription? Unlike with other services (e.g. cell phone plans, cable TV, …) this is actually an easy one: Mozy is the best thing that ever happened to my backup needs (that really cheap DAT tape drive that I bought about 12 years ago is a close second). There is really no question if or why I should renew.

I take a lot of pictures, and of course these pictures are digital. If something should happen to the data that I store locally, I need a reliable off-site backup. I used to keep a backup disk in my office, but it just got too cumbersome to always carry the disk back and forth and to update it frequently enough. Mozy takes care of all that. Automatically.

After the initial setup, it only requires me to check every now and then that all the important directories are covered. I also do occasional restores, just to make sure that my data is there – my assumption is that a partial restore is sufficient to verify that that’s the case.

My only complaint was that whenever a backup was running, it saturated my Internet connection, but since I figured out how to throttle the upload bandwidth that Mozy will use, that’s no problem anymore. It’s a configuration setting that I just did not notice at first.

Just for the record, I’m using Mozy on a Mac, but I assume that the Windows software is as reliable as the one that I’m using.

If you want to give Mozy a try, here are a few links. I even have a coupon code for you that’ll save you a few bucks: Use the code APRIL when you sign up for one of the non-free plans. Just type the code into the referral box at sign up to get a 10% discount. If you just want to give it a try, use the free plan. That allows you to get a feeling for what Mozy is, and how (well) it works. You have 2GB of storage space.


These are affiliate links, so I get some kickback from Mozy, but I would not recommend the service if I would not be completely satisfied with it. You can trust me on that.

17 Mar 2009

My PDF Toolbox (Updated)

Posted by khk. No Comments

[ Due to a huge amount of comment spam, comments on this post are now disabled ]

What tools am I using to create/process/debug PDF documents? Here is list of my top tools and why I like them.

Adobe Acrobat Pro


This of course is the mother ship, the ultimate tool for creating, processing, editing PDF documents. It’s the solution to problems you did not even know you had… Most people only use a small fraction of the features that Acrobat provides. It’s not cheap, but if you require any of the features that no other tool provides, it’s worth it.

Here are a few tasks that I use Acrobat for:


  • Create

  • If you want the best quality PDF document, how can you go wrong with the Distiller from the people who invented PDF? There are many ways to create PDF files, but for high quality press work, I would not trust any other application.
  • Edit and Process

  • Optimize, preflight, manage colors, insert pages, extract pages, remove pages, change page boxes, create interactive forms… Do I need to say more? Pretty much anything that’s possible with a PDF document can be done with Acrobat. Sure, there are other tools that can do some of these tasks as well, but there is no other tool that covers the broad range of features available in Acrobat.
  • Debug

  • The preflight tool allows to check for syntax errors in PDF files, traverse the internal structure of PDF documents, look at fonts, …
  • Programming

  • I also write software for Acrobat. That’s either done as a plug-in or as JavaScript, for demo purposes I occasionally also write sample VB programs that utilize Acrobat’s Inter-application Communication API.

Adobe Reader


This one is pretty straight forward: I use it to make sure that PDFs created in Adobe Acrobat work correctly when opened in a web browser or directly in Reader. Especially when dealing with forms submission or electronic comments, it is necessary to make sure that Reader behaves correctly.

Ghostscript


Oftentimes it is beneficial to have a non-Adobe PDF renderer. When a PDF file is not behaving correctly, I run the file through Ghostscript to see if it fails in the same way, or if I can get more detailed error messages out of that application. The error messages Acrobat provides are not very verbose, Ghostscript can give me a stack dump, and if necessary I can even run it in the debugger to figure out exactly what’s going on.

XPDF


The same reasons I gave for Ghostscript also apply to XPDF. In addition to that, XPDF also comes with a bunch of tools to extract text or images from a PDF file. Sometimes that functionality comes in handy.

iText


This is a very powerful PDF library for Java. In addition to being very powerful, it’s also relatively easy to use. I have not done anything serious in Java in years (a decade?), but it does not take me long to take iText and whip something up that can almost perform miracles with PDF files. There is also a .NET port available as iTextSharp.

pdftk


pdftk is an application that’s based on iText. Sid Steward took the iText Java source code and run it through a compiler to create a native binary for Windows, Mac OS and Linux. Because of that, pdftk does not require Java anymore. All that’s needed is a supported operating system.

It is a tool to do a number of things with PDF files (concatenate files, break a multi-page file into individual page documents, flatten forms, …). Take a look at the page that lits pdftk sample command lines to learn more about what is supported.

There is a small problem with pdftk: It’s no longer supported, and it cannot handle PDF files that use some of the newer PDF features. Also, there are (at least) two versions that are currently getting distributed: Get the newest one from http://www.pdfhacks.com/pdftk and not the one from AccessPDF. (Update: Both links now have the same version).

Mac OS X


Yes, the Mac operating system does provide some PDF related tools. There is the Preview.app application to display and manipulate PDF files, and there is the “Save as PDF” feature built into the print dialog. Not only can you save “normal” PDF files with just one mouse click, you can create press standards conform PDF/X files.

Enfocus Browser


The Enfocus Browser is two things:

  • An Acrobat plug-in

  • A standalone application


And, it’s these two things for two operating systems: Windows and Mac OS. This tool is indispensable when you are working with the structure of a PDF file. Enfocus released version three of this tool a while ago. I mentioned this tool a couple of times already on my blog:

My Favorite Acrobat 8 Feature

The Enfocus Browser is Back

One of the best features of the Browser is that it allows you to actually modify the PDF structure, however, you better hold back on that until you’ve read the PDF spec a couple of times. It’s very easy to break a PDF file by making just a few changes.

One of the biggest advantages of the standalone version is that I can look at a PDF file that may not open in Acrobat and find out why.

There are a number of other applications that I don’t user personally, but that I do recommend to others because I know how good these apps are. More about that in a future post.

11 Mar 2009

Acrobat, JavaScript and VB walk into a bar…

Posted by khk. 18 Comments

Update:

Please visit the same post on my business site. The comments are closed here, so if you want to comment, you have to head over to http://khkonsulting.com/2009/03/acrobat-javascript-and-vb-walk-into-a-bar/

OK, let’s just forget about that old joke and concentrate on how to combine all three into something that is quite useful.

As I’ve described in one of my previous posting, it is quite easy to automate Acrobat from VB or VBA. So how does JavaScript fit into this picture? As you may know, Acrobat comes with a very powerful JavaScript engine that provides access to a lot of functionality – more functions actually than what you have access to from your VB program. So, if you want to access some of these features, but you are stuck with VB, how can you do that?

Adobe provides a VB/JavaScript bridge with Acrobat – the JSObject, and the Acrobat SDK describes how to use that feature.

There is quite a bit of good information in the documentation. When you access the online documentation, expand the tree to “Acrobat Interapplication Communication > Developing Applications Using Interapplication Communication > Using OLE > Using the JSObject interface”.

JavaScript

In this example, I want to illustrate how you can create a folder level JavaScript function, instantiate the JSObject, and then call the custom function and display the result in VB. My plan was to use the JavaScript code from my last posting, but I found one small problem in the way I wrote the code (it works fine as a standalone JavaScript program, but we cannot use it in the VB context), so here is it’s replacement:

function CountBookmarks(bkm, nLevel)
{
    var count = 0;
    if (bkm.children != null)
    {
        count = bkm.children.length;
        for (var i = 0; i < bkm.children.length; i++)
        {
             count += CountBookmarks(bkm.children[i], nLevel + 1);
        }
    }

    return count;
}

function CountAllBookmarks()
{
    console.clear(); console.show();
    var n = CountBookmarks(this.bookmarkRoot, 0);
    console.println("Number of bookmarks found: " + n);

    return n;
}

// add the menu item
app.addMenuItem({
     cName: "countBookmarks",
     cUser: "Count Bookmarks",
     cParent: "Document",
     cExec: "CountAllBookmarks();",
     cEnable: "event.rc = (event.target != null);"
});

Save this JavaScript program as a folder level JavaScript file and make sure that it works.

So, why can’t we just implement the whole algorithm with the JSObject? The problem is with how VB handles objects that are actually JavaScript objects – in this case the root bookmark object. I cannot figure out how to access it’s “children” property through the JSObject. That’s the reason why I’m “cheating” by calling our custom JavaScript function – being able to do that is pretty cool IMHO.

The VB Part

We start out just like with any other VB program, by declaring some objects, initializing them and then it gets interesting…

Here is some sample code that shows how to initialize the JSObject, and how to call our own JavaScript function.

Create a button on an Excel spreadsheet again, and put the following code into the button handler callback (just like before).

Dim gApp As Acrobat.CAcroApp
Dim gPDDoc As Acrobat.CAcroPDDoc
Dim jso As Object

Sub Button1_Click()
    Set gApp = CreateObject("AcroExch.App")
    Set gPDDoc = CreateObject("AcroExch.PDDoc")
    If gPDDoc.Open("c:\temp\test.pdf") Then
        Set jso = gPDDoc.GetJSObject
        MsgBox (jso.CountAllBookmarks())
    End If
End Sub

Now just make sure that you have a file c:\temp\test.pdf that has some bookmarks in it.

11 Mar 2009

Counting Bookmarks

Posted by khk. 1 Comment

Please visit the same post on my business site. The comments are closed here, so if you want to comment, you have to head over to http://khkonsulting.com/2009/03/counting-bookmarks/

Let’s assume you have a PDF document, and you want to know how many bookmarks you have in that document, how would you approach that?

The JavaScript API has methods to traverse the bookmark tree. Here is a short program that – once installed in Acrobat’s JavaScript folder – will add a menu item “Count Bookmarks” to the “Document” menu, and when executed will print the number of bookmarks encountered in the JavaScript console.

function CountBookmarks(bkm, nLevel)
{
    var count = 0;
    if (bkm.children != null)
    {
        count = bkm.children.length;
        for (var i = 0; i &lt; bkm.children.length; i++)
        {
             count += CountBookmarks(bkm.children[i], nLevel + 1);
        }
    }

    return count;
}

function DoIt()
{
    console.clear(); console.show();
    var n = CountBookmarks(this.bookmarkRoot, 0);
    console.println("Number of bookmarks found: " + n);
}

// add the menu item
app.addMenuItem({
     cName: "countBookmarks",
     cUser: "Count Bookmarks",
     cParent: "Document",
     cExec: "DoIt();",
     cEnable: "event.rc = (event.target != null);"
});


Save this program in a file in e.g. C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Javascripts (for Acrobat 9) and restart Acrobat. You should now find a new menu item in the Document menu. Load a file with bookmarks in it, and execute the menu item.

I have not implemented the privileged execution context that is required to make this work in all instances, so you have to go into your JavaScript preferences in Acrobat and check the setting for “Enable menu items JavaScript execution privileges”:

PreferencesJavaScript.png

10 Mar 2009

Security Patch for Adobe Acrobat 9 and Reader 9

Posted by khk. No Comments

[ Due to a huge amount of comment spam, comments on this post are now disabled ]

This is hot off the press: Adobe recommends that you upgrade your Adobe Acrobat 9 or Adobe Reader 9 installation to 9.1: Security Updates available for Adobe Reader 9 and Acrobat 9

Here is what Adobe has to say (among other things) about this patch: “Adobe categorizes this as a critical issue and recommends that users apply the update for their product installations.” More information is available on the page I linked to.

Upgrade! Really!