2 posts tagged “programming”
Since the documentation for SharpPDF is absolutely crappy and lacking, here is how I added a web-based image to a PDF.
objPDF is my pdfDocument, and odjPDFPage is my pdfPage.
Dim objWeb As New System.Net.WebClient
Dim objImg As System.Drawing.Image
objImg = System.Drawing.Image.FromStream(objWeb.OpenRead("http://blah.com/whatever.gif"))
objImg.Save("c:\temp.gif")
objPDF.addImageReference("c:\temp.gif", "logo")
objPDFPage.addImage(objPDF.getImageReference("logo"), 40, 730, 16, 100)
I'm temporarily putting it into the file system, which I still need to cleanup - but that's how you do it.
Note that SharpPDF needs the height and width to be halved, at least for my purposes - the image I'm using is really 200x32, e.g.
I understand that a basic programming concept is that zero is not nothing (or null). I get it.
But that doesn't mean it isn't a total pain to work with.
In ASP.NET (my favorite language!) I'm working with a dataset. This dataset has no tables in it. So, one might think that the dataset's tables.count property would be 0. Right?
Nope. It's nothing/null.
But shouldn't it be both, technically? There aren't any tables, so that's nothing. But zero can also mean nothing. I know that in the abstract concept sense, it can mean something. But in this specific instance, I have to check for null instead of just checking for zero.
It's kind of lame. I accept it. But it's lame.
---
Oh, okay. Here's why it was nothing: I didn't really make a dataset.
This is a syntax issue with VB.NET (and presumably C#) that trips me a lot.
Dim dsBlah as DataSet
Dim dsBlah as New DataSet
Only the second one makes a dataset. The first one doesn't. It simply reserves the variable. Also, I don't seem to have this problem in PHP. Weird.