« Older Entries Newer Entries » Subscribe to Latest Posts

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!

4 Mar 2009

Adobe Acrobat and VBA – An Introduction

Posted by khk. 111 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/adobe-acrobat-and-vba-an-introduction/

Here is another topic that comes up every now and then: How can I “talk” to Adobe Acrobat from e.g. MS Excel via VBA? I’ll try to give an introduction into that subject in this document. I will only discuss the basics, but I’m open for suggestions about what part to discuss next. So keep the comments coming.

More after the jump…
Read the rest of this entry »

Tags: , , , , ,

3 Mar 2009

The Best Free PDF Creator

Posted by khk. 4 Comments

I get this question every now and then: What is the best free PDF creator? If all you want to do is to create a PDF file every now and then, the full Adobe Acrobat is overkill and way to expensive. There are cheaper solutions, but free is always better than cheap…

I don’t know what “the best” solution is, but I’ve looked at a bunch of them, and I know which one of those I consider the best for my purposes: The PDF generator that’s built right into the Mac’s print dialog.

MacOSPrintToPDF.png

Ah, the question was meant about Windows… In that case, I would recommend PrimoPDF. The software recently got acquired by NitroPDF, and these people know PDF.

I’ve recommended PrimoPDF since it first appeared on the scene in 2004, and I’ve never heard any complaints.

So, if you need to create PDF documents, and you don’t care about all the other (really excellent) features of Adobe Acrobat, give PrimoPDF a try.

PrimoPDF.png

And, if you need less expensive alternative to Adobe Acrobat, give their NitroPDF application a chance. I don’t have much first hand experience with it, but I keep on hearing good things about it.

Tags: , , ,

2 Mar 2009

Data Rot

Posted by khk. No Comments

I still have a few stacks of punch cards at my mother’s house, while cleaning out my office last week, I found a 5 1/4″ floppy disk, and then of course, I have a ton of negatives and slides…

CBS has posted David Pogue’s report about how our data dies because we either can no longer access it or because the original media used to store data is falling apart.

Watch CBS Videos Online

Let’s see how long it takes until we no longer have a Flash player that can play that video.

21 Feb 2009

Coffee Roasting

Posted by khk. No Comments

I drink coffee. Not only do I drink coffee, I do care enough about the coffee that I make at home that I did a lot of research to decide what kind of machine and what brand and model to buy. In addition to the hardware, there is the software, and I try to get freshly roasted beans. Unfortunately, my favorite local coffee roaster sold his business, and the new owners cannot reliably deliver the same quality of coffee.

So, how can I make sure that I always have freshly roasted coffee beans available? Or, as some of my friends would put it, how can I waste even more time on my morning cup of coffee?

Of course, home roasting is the answer to that question.

How to turn a bag of green coffee beans into something that can be used in a coffee maker or an espresso machine? After some serious research online I noticed that one company name came up again and again: Sweet Maria’s Home Coffee Roasting Supplies.

Coffee Roasting

More after the jump… Read the rest of this entry »

15 Feb 2009

No More Craft Magazine

Posted by khk. No Comments

CRAFT: Volume 10 is the last one in print. Looks like people are no longer reading printed paper. Or, maybe too many of the CRAFT issues landed on the junk mail pile…

The silver lining in this is that my MAKE subscription will get extended by two issues.

Tags: , ,