Results 1 to 5 of 5

Thread: PrintToPrinter method is not printing,just creating PDF file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2012
    Posts
    31

    Question PrintToPrinter method is not printing,just creating PDF file

    Please see my code below

    Dim dfg As DataSet = searchobj.searchmethodsampleno(sampleno)
    If dfg.Tables("entertest_table").Rows.Count > 0 Then
    Dim reportviewerobj As New Form1
    Dim obj As New CrystalReport_invoice
    reportviewerobj.getDSprint(dfg, obj)

    obj.PrintToPrinter(2, False, 0, 1)

    it is just saving the contents as pdf file and opening the pdf file.But not printing.please guide

  2. #2
    Hyperactive Member
    Join Date
    Jul 2007
    Posts
    476

    Re: PrintToPrinter method is not printing,just creating PDF file

    The PrintToPrinter method

    "Prints the specified pages of the report to the printer selected using the PrintOptions.PrinterName property. If no printer is selected, the default printer specified in the report will be used."
    So is it possible you are not specifying a printer but used a pdf driver to create the report?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2012
    Posts
    31

    Re: PrintToPrinter method is not printing,just creating PDF file

    I did not define printer name,so it must choose default printer,But why does this happen?..Printer is connected with my system over network.So,is it the problem?...or why does this happen?

  4. #4
    Hyperactive Member
    Join Date
    Jul 2007
    Posts
    476

    Re: PrintToPrinter method is not printing,just creating PDF file

    You did not answer if you created the report on a pdf printer driver, nor did you extend the concept to tell us what the default printer driver is on your computer.

    Quote Originally Posted by suhailtholakkal View Post
    ...But why does this happen?..Printer is connected with my system over network.So,is it the problem?...or why does this happen?
    The only answer I can give you right now is that the quote I gave you is from the MSDN documentation on the method you were using. Why it works this way is like asking "why do we stop at a red light and go on green". The answer is "because that is the way it is".

    Computers are really good at doing things you tell them. But if you don't tell them, they do not assume what you want. They just do what you told them before.

    So check the printer it was designed for and see if it is still on your system. If so, then it is probably the one that is being used because you didn't tell it any different.

    Some people have a policy to design Crystal reports using the No Printer option. I don't really know if this is better or not but it might be worth testing. Then the report might automatically pick up the default Windows printer.

  5. #5
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: PrintToPrinter method is not printing,just creating PDF file

    I did not define printer name,so it must choose default printer,But why does this happen?..
    Because "Default" means: that which will be used when you haven't specified otherwise.

    So it's going to use the printer you specify for the print. If you don't specify one it will use the default printer specified in the report. If no default printer was specified for the report it will use the defauilt printer specificed in Windows. It will use the first printer it can along that chain and, if that is a pdf printer, it will create a pdf document because that's what pdf printers do.

    The fact that you've got a real rinter attached, whether it's over a network or locally, is irrelevant unless that printer is the first one found along the aforementioned chain.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width