Archive for July, 2009
One feature of .NET that I use regularly is image scaling. I typically use this on web sites that need image upload capabilities. I assume the user is going to send me an image that is significantly bigger than what I could use and then scale it down before storing it.
I also use this feature so that I only have to store one image. If I need it at a different size, I can scale it prior to sending it down to the browser. In this case, I implement .NET page caching so that I don’t have to run the scaling code every time the image is requested.
Image scaling really isn’t that hard. Here’s how it’s done.
I sent out the following tweet last week:
“Where’s the refactor menu option?! Oh, wait. This is VB.NET, they don’t have that feature.”
Almost immediately, I got responses. The most helpful was from @RoryBecker letting me know about CodeRush XPress by Devexpress.com
This tool does way more than I was immediately looking for and it is free.
Instead of just allowing me to promote a block of code to a method it will:
Now that we have the HTML cleaned up, the next thing we will want to do is to parse the HTML.
In my actual code for this, I parse the HTML and create the PDF at the same time, but for the purposes of these posts, I’m going to deal primarily with parsing the HTML here and then deal with the PDF creation code later.
I get several questions a week via the “Click Here to Ask a Question.” I would like to say I answer all of them, but I don’t.
The number one reason I don’t answer a question is because I’ve already answered the question somewhere on this blog. Yes, I actually spend the time to make sure I did.
The second most frequent reason for ignoring a question is because it is in the form of, “Is demo available in VB?”
Both of these types of questions bother me for the same reason. So here’s my generic answer to everyone who sends me a question of these two forms.
While this isn’t specifically targeted at iTextSharp, which we’ve been covering in recent posts, this is really the closest book you are going to find on the subject.
The basics are the same. Keep in mind that the main difference is that setPropertyName and getPropertyName methods have been changed to .NET style properties (versus Java style) where it makes sense. Method names start with a capital letter in iTextSharp, and event wiring is a little funky (we’ll get to that later).