0
votes

My current job is creating mechanical drawings that are used to sent to clients and as shop drawings. When my drawing is finished I export a .pdf file and this is sent to the client.

Our clients are a big fan of black and white drawing so I try to provide them. But the software I'm using to draw gives an bad result. It only has an option "all colors as black" and I have some "hidden lines" on my drawing that are white. Of course these show up using the all colors as black option.

I found a solution and thats using a pdf printer. Works great, and the result is great.

Now I would like to print this .pdf by code. But I don't have an idea how to do this.

My pdf printer: "Easy PDF" Bullzip PDF Printer

1

1 Answers

0
votes

I had made a small utility for printing before, the following coed will bring up the printers attached/installed on the computer and you can pick whichever one you need. You need to add a print dialog to the form and do this (you will have to select a pdf printer from the dialog box)

    Dim dlgPrint As New PrintDialog

    If dlgPrint.ShowDialog() = Windows.Forms.DialogResult.OK Then

        Dim objPrinterName As New PrinterSettings

        objPrinterName.PrinterName = dlgPrint.PrinterSettings.PrinterName
        UpdateLabel(objPrinterName.PrinterName.ToString, objPrinterName.DefaultPageSettings.PaperSize.ToString)

    End If

I have a label on the form to display the selected printer. then I print the page using this

        printFont = New Font("Courier New", 10)
        Dim pd As New PrintDocument()
        AddHandler pd.PrintPage, AddressOf Me.pd_PrintPage
        pd.PrinterSettings.PrinterName = Label2.Text
        pd.Print()

Print page is another event which formats a page to user requirements you can ignore that for now.