Jason N. Gaylord
Coder
from Northeast PA
Small planet on JasonGaylord.com A planet with rings on JasonGaylord.com
Visit JasonGaylord.com

Hello, I'm  jasongaylord Jason

I live with my family in the rolling hills of Northeastern Pennsylvania. I'm a web developer by trade, but have broad experience in various business areas. Want to know more about me?

Learn More

Reminder: .NET Valley Event Tomorrow

The next .NET Valley meeting will be held on Wednesday May 24th at Johnson College, Scranton PA. A map of the campus can be found here. We will meet at the Moffat building in computer lab 102. The event will begin at 6pm.Presenting for .NET Valley …

Read More

ASP.NET Podcast Show #53

The ASP.NET Podcast show #53 has been released on the ASP.NET Podcast site. It includes a talk by Doug Reilly, Todd Miranda, and Dell “going” AMD. The main topic is an Atlas ListView and some declarative databinding.

Read More

Off Topic: BBC News Interviews Wrong IT 'Guy'

One of my co-workers sent this link to me. It’s quite funny. I wonder if the wrong “Guy” ended up being hired? http://news.bbc.co.uk/2/hi/entertainment/4774429.stm

Read More

ASP.NET Blogs Updated to Community Server

Finally the ASP.NET Blogs have been updated to Community Server 2.0. I know I’m a bit late on posting this, but I’ve been away and just realized this today. What a great jump from .TEXT to CS 2.0. If you notice any quarks, let me know and I’ll be sure…

Read More

Background Printing PDFs

A common task that developers attempt to do is print PDF files from code. Unfortunately, there is no simple and easy way of doing this. However, I found a work around using the Acrobat Type Library that can assist with this. It’s by no means the best solution, but will allow you to perform background printing:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Public Shared Function PrintPDF(ByVal Filename As String) As Boolean  
    'Declare Variables  
    Dim AcrobatApp As New AcroApp  
    Dim AcrobatDoc As New AcroAVDoc  
    Dim AcrobatPDFDoc As New AcroPDDoc  
    Dim TotalPageCount As Integer  
    Dim ResultsBoolean As Boolean  
    Dim ReturnBoolean As Boolean = False  
  
    Try  
        'Attempt To Open The Report  
        AcrobatDoc.Open(Filename, "")  
 
        'Pass the Document to the PDF Handler  
        AcrobatPDFDoc = AcrobatDoc.GetPDDoc  
 
        'Grab the total number of pages  
        TotalPageCount = AcrobatPDFDoc.GetNumPages  
  
        'Perform a background print using Acrobat  
        ResultsBoolean = AcrobatDoc.PrintPagesSilent(0, TotalPageCount - 1, 0, False, True)  
  
        If ResultsBoolean = False Then  
            Throw New Exception("Acrobat returned a False value when attempting to print the pages in the background.")  
        Else  
            ReturnBoolean = True  
        End If  
    Catch ex As Exception  
        'Add In Exception Handling  
    End Try  
 
    Return ReturnBoolean  
End Function
Read More

Setting the Default Printer in a Win App

Sometimes you just can’t get around using old API calls. One of the things (unless I’ve missed it) that is not found in the .NET Framework 2.0 is a Printers class that contains methods for enumerating printer objects, setting properties, etc. You can read 99% of the properties using the PrinterSettings class in System.Drawing.Printing, but you can’t set the properties there. In VB6 we had to call the WriteProfileStringA method in Kernel32. In .NET 1.x or 2.0, we can use WMI script with the System.Managment namespace to make similar calls. One of the tasks I had earlier was to set the default printer using a function. Here is what it would look like using the System.Managment namespace:

```vb Public Shared Function SetDefaultPrinter(ByVal PrinterName As String) As Boolean
    ’Declare WMI Variables
    Dim MgmtObject As ManagementObject
    Dim MgmtCollection As ManagementObjectCollection
    Dim MgmtSearcher As ManagementObjectSearcher
    Dim ReturnBoolean As Boolean = False

Read More

New ASPInsiders.com Website Released

The ASPInsiders have released a new version of their website at aspinsiders.com. Be sure to visit it and provide us with your feedback.

Read More

Windows Live Messenger Beta Released

Microsoft has released the Windows Live Messenger Beta. Some of the new features include new voice and video capabilities, sharing folders, live contact information, and offline messaging. Also, some new phones are Windows Live enabled including a phone by Uniden. Microsoft has worked with Verizon to offer a low cost phone plan of 1.9 cents per minute.

Read More

.NET Valley Meeting Building and Room Announced

Next week’s .NET Valley meeting will be in the Moffat building in computer lab 102 at Johnson College in Scranton, PA. For more information about the event, please visit DotNetValley.com.

Read More

XML Specification Issue

Monday we had an issue with one of our data providers. Our application continually timed out and we couldn’t figure out why. It turns out that they updated the XML spec for the data and never notified us. Because of their unique data structure we had to …

Read More