10
Feb
2014

Exporting HTML Tables to Excel

Posted by emijayne

We are transitioning a major system (2-3 connected applications) this year at work and one thing that that is falling through is reporting. So, I am trying to help bridge this gap by creating a couple of simple queries in a section of our intranet. Straight PHP/SQL query in a node... simple enough. (OK, it may have been a teensy bit more complicated with the addition of colored rows based on data, but still pretty simple.) I posted my first of such reports last week. It had only been known by one or two people, but it was a successful trial. Then they forwarded the request on to others.. others who wanted it in PDF and Excel.

Well, PDF is simple enough, just print the page to Adobe. But Excel? ok.. let me figure out a download link for you...

Shrinking time here, but there was quite a bit of research and testing for a few hours.. sigh.. but I get bored when things don't happen easily.

hmm.. maybe I should just tell him to copy the table and paste it into excel...

*highlights table*

see? it'd be easy enough.. just have to do a little cleanup.. sigh. no, they won't go for that..
wait..
.. what's that icon?

*clicks icon*

huh.. i wonder if there is an accelerator for Excel..

*searches*

nope. Well.. let's see if we can save it as..

*right clicks on table*

Woah.. you're kidding me.. it's that easy?

.. so yea, that was a fun discovery. Wasted a few hours of pointlessness when Microsoft had already fixed the problem for me. Yey!! :)

Tags: 
10
Jan
2014

That's Life!

Posted by emijayne

Wow.. well, I haven't posted since Oct '12, it seems that life kinda got away from me. :)

Since it's been like a year and a half, I think I'll fill you in on why I've been so busy. The last few months of 2012 was taken up with preparing my coworkers for my impending leave of absence... because come December, this cutie finally made his way into the world:

Between him and teenagers, you might understand how my life has been wonderfully crazy busy ever since. Now that he's turned one, life is on overdrive running after a very energetic toddler. :)

Have a great weekend, everyone!  <3

Tags: 
21
Oct
2012

Craigslist Newbie

Posted by emijayne

We came into possession of some really nice shoes that we now want to sell. They are all decently expensive, mostly European leather made.. so I couldn't bear to throw them out with the rest of the junk.

eBay gets a little complicated, so I thought I'd try Craigslist for the first time ever. I took pictures and uploaded all 6 pairs of shoes onto the website yesterday morning. When my hubby and I got home last night, I found an email inquiring whether a certain pair was still available. Score! :)

Still up for sale?

I replied back that they were, indeed, still available. I also told him that we'd take either paypal or cash, and offered two different towns for pickup. I didn't know from where he was coming, after all.

Within a minute, I received this..

Hi
Thanks for the response.I am willing to pay your asking price.I will
pay by money order as its the only way i can pay you at the moment.I
will make arrangement for the pick-up after payment have been received
by you. I dont mind adding an extra twenty dollars so you can keep it
in my favor.Reply with your full name,cell phone number,and address
where payment should be sent.Please take the posting off craigslist
today and consider it sold to me. Expecting to hear from you soon
Thanks

Sounds really nice. I didn't respond back right away.. and it was nagging at me all day. It just sounded too nice, and I'm smart enough to avoid the whole money order thing. So, I phrased a few drafts in reply.. and decided to google his email instead.

oh oh!! Quelle suprise! Scam. ugh. Thank God I didn't take his offer!!

proof, more proof, still moreproof...

Tags: 
08
Oct
2012

Acrobat Javascript with Actions and Stamps

Posted by emijayne

Imagine for a moment that it is your job to process hundreds of engineering 'blueprints', by rubber-stamping each one. In this little stamped form, you need to write often the same bit of information on every drawing. Fortunately, in today's world real blueprints have been replaced with black and white electronic files. And in today's world we have the technology that can allow you to automate this entire stamping process... making days of work be filtered down to maybe an hour. [In this scenario the files are all in PDF format and we are using Adobe Acrobat X Pro.]

The Problem:
A batch process needs to be done on multiple PDF files. This batch process will need to:

  • cycle through all files (regardless of the number of files),
  • use a customized version of Acrobat's "stamp" annotation in order to automatically place (possibly multiple versions of) text onto each file,
  • save and overwrite (flatten) that file

The Twist:
This was accomplished once. A programmer had written a multi-program approach in VB6. One began the process in MS Outlook, stepped through MS Word, and ended up in Acrobat 8 while utilizing a tool written for Acrobat 5. It was memory-hungry, and it (usually) worked. Then the user group was upgraded to brand-new Windows 7, 64-bit machines, running MS 2010 and Acrobat X Pro. Oy! All VB6 programming was now out the window with the introduction of MS' VB.NET... and that fun little Acrobat 5 tool could no longer function in the new Acrobat X environment.

The Solution:
It seemed convoluted to me to rewrite it exactly in the same manner. (Although, at first I did try rewriting the VB6 script into .NET. It really didn't translate well.)
It also seemed illogical that there wasn't a way to do this whole process directly inside Acrobat X. As it turns out, there is a way.. I just needed to learn Acrobat's version of JavaScript. :)

Step 1: Getting the Data

The dynamic stamps that are built-into Acrobat, pull data that is stored either in the system or the document itself. So, my logic was to do the same with my bits of information that I needed to utilize. The first bit was just the file name, then there were a few other bits of text that the user would need to supply.

Since they may have to batch 200 of these files, I didn't want them to be interrupted and asked EVERY time a file popped up. So, I created a simple form asking for those extra bits of information. At the bottom of this form, I created a "save settings" button. This button takes each of those fields and saves them as Global Variables, deleting the variable first as good practice.

delete global.usrtxt1;
delete global.usrtxt2;
global.usrtxt1 = this.getField("UserText1").value;
global.usrtxt2 = this.getField("UserText2").value;

Step 2: Building an Action

Once those variables are set, I have the user run the Action Wizard that I set up for them. ["Action wizards" are found under "Tools", and replace the old batch processes before Acrobat X.]

I set up a folder for each user to dump all the files they need to process. This wizard runs through that folder, going through all the steps that I set up. It then saves each file in the same folder.

The first step executes a bit of JavaScript on the file. The intention here is to grab the global variables, and insert them into the document's meta information. This way, it is usable to the dynamic stamp we'll set up later. Now, I had a bit of fun with this one because even though the first variable is always the same for each document, the second variable may be different for each document. The code below is set so that if the variable does not exist, it will prompt the user for the information.

this.info.usrtxt1 = global.usrtxt1;
if (global.usrtxt2) {this.info.usrtxt2 = global.usrtxt2;}
else {
var ut2 = app.response({
cQuestion: "Enter the text.",
cTitle: "Text",
cLabel: "Text:"
});
this.info.usrtxt2 = ut2;
}

Acrobat allows for "instruction steps". The second step is an instruction that will simply prompt the user to stamp the file. Once the stamp is set, the user will tell the process to continue.

As I mentioned before, each file is saved along the way.

Step 3: Dynamic Stamp Creation

I needed a stamp that will be able to utilize those bits of text that were first saved as global variables, then transferred to the document itself.

Creating a customized stamp is pretty simple. You simply

  • go to Comment,
  • Annotations,
  • select the Stamp tool,
  • select Custom Stamps,
  • then Manage Stamps.
    • A dialog box will appear and you select Create,
    • browse to the PDF or image file you would like to use as your stamp, and click OK,
    • Select the category under which you'd like to file the new stamp, write a new name, and click ok.
  • Select "ok" to get out of the "Manage Custom Stamps" dialog.

Voila! You are done. Now to use the stamp, you'd simply go back to the stamp tool and select your new one. However, this is just a flat image with no customized text.

Although it starts there, creating a Custom Dynamic Stamp is a little different. There are many great tutorials on how to create a customized dynamic stamp. The gist of using dynamic fields on a stamp is that they MUST be calculated fields. To my understanding, this calculation forces the field to update before it is used on the document.

What I needed for this stamp was the document name and the two user defined fields back from step 1.

Below is the calculation I used for grabbing the document name. You'll see a split/shift thing going on.. and basically that allowed me to chop off the file extension. Pretty cool stuff. :)

var myFilename = event.source.source.documentFileName;
var fileNmRoot = myFilename.split(".").shift();
event.value = fileNmRoot;

For the two user defined fields, I simply told it to look for the field that was saved into the document's meta information. The code for these two fields are the same:

var ut1 = event.source.source.info.usrtxt1;
event.value = ut1;


var ut2 = event.source.source.info.usrtxt2;
event.value = ut2;

.. and that's the end of the story. :)

Tags: 

Pages