Results 1 to 6 of 6

Thread: How to change the predefined printer with code using VDF17.0 and CR 9

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default How to change the predefined printer with code using VDF17.0 and CR 9

    Hi,

    We are having some troubles trying to change the predefined printer. We use 1 object for all the reports.

    On the event Onprint of the object we are trying to modify the predefined printer using:

    Code:
    send comselectprinter of horeport driver printername printerport
    with this, all seesm to work but in the second it gonna start printing we get memory exception on the studio, or in case that try running the exe directly it gives an error and closes.

    We also tried using:

    Code:
    set pbprinterprompt of horeport to true
    but this way we cant choose the printer we want, it uses directly the printer defined on the rpt or the printer predefined on the machine, depending how the rpt is configured.

    so my question is: there is anyway to put working the first example? or if there is a way to be able to choose the printer we want using the crystal dialog?

    thank you in advance

    regards

    Miguel Silva

  2. #2
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,137

    Default Re: How to change the predefined printer with code using VDF17.0 and CR 9

    I use:

    Code:
                Send ComSelectPrinter of hoReport "winspool" (Trim(SYSINFO.PackListWhite)) (Trim(SYSINFO.PackListIP))
    The 2 file.fields hold the printer name & IP address of it ("PackWhite" ,"IP_192.168.0.250"). Note that even though the IP address may point to a network printer, I've found that the printer must be installed on the machine running the report.PrinterInfo.vw

    Here's a view that gets the info in the manner CR wants it.PrinterInfo.vw
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  3. #3

    Default Re: How to change the predefined printer with code using VDF17.0 and CR 9

    Hi Garret,

    I already tried that with your Getprinter function inside ur view. The problem is that after pass through the code without errors, in the second it will start printing(you can see the dialog of printing 1 of x) makes a memory exception on the studio( or exe error if u run it without studio)

    I made a check after send the comselectprinter command and took again the driver, port and printername but this time using the functions inside Craxddrt.pkg from crystal 9. I noticed that the printer name and driver is the same but the port changed from "HPLaserJet1022n" (the port of my printer) to "Ne02:"

    so maybe that is what is messing up. Any advice is welcome because im running out of ideas to make this work.

    Regards.

    Miguel Silva


    Quote Originally Posted by Garret Mott View Post
    I use:

    Code:
                Send ComSelectPrinter of hoReport "winspool" (Trim(SYSINFO.PackListWhite)) (Trim(SYSINFO.PackListIP))
    The 2 file.fields hold the printer name & IP address of it ("PackWhite" ,"IP_192.168.0.250"). Note that even though the IP address may point to a network printer, I've found that the printer must be installed on the machine running the report.PrinterInfo.vw

    Here's a view that gets the info in the manner CR wants it.PrinterInfo.vw

  4. #4
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,137

    Default Re: How to change the predefined printer with code using VDF17.0 and CR 9

    ?? The port (3rd parameter) should be an IP address.

    If you can't choose the printer from the prompt, then I don't think you'll be able to print to it. If the printer is installed on the computer, why can't you get to it from the prompt? I think I'm missing something here.

    In my experience, any network printer CR needs to print to must be installed locally before printing from CR will work.
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  5. #5

    Default Re: How to change the predefined printer with code using VDF17.0 and CR 9

    Hi Garret,

    We have configured the port with a name, anyways i also tried using the ip insted with the same result.

    I have the printer installed on my machine aswell, and it actually appears on the windows print dialog to be selected. But without using CR print dialog u can go through all the code without getting error. when u finally finish and the application shows the dialog of the current progress (page 1 of x), in that moment we get a memory exception on the studio.

    The point not being able to select the printer is if we use CR print dialog ( set pbprinterprompt of horeport to true). In this case it shows the CR dialog but predefined to the machine predefined printer or to the report predefined printer( depending how is configured the report in design)

    Thanks in advance

    Regards.

    Miguel Silva

    Quote Originally Posted by Garret Mott View Post
    ?? The port (3rd parameter) should be an IP address.

    If you can't choose the printer from the prompt, then I don't think you'll be able to print to it. If the printer is installed on the computer, why can't you get to it from the prompt? I think I'm missing something here.

    In my experience, any network printer CR needs to print to must be installed locally before printing from CR will work.

  6. #6
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,137

    Default Re: How to change the predefined printer with code using VDF17.0 and CR 9

    Do other printers act the same way? Is it mabe that CR 9 gets confused by some new feature in the printer? Ver. 9 is pretty old after all & I could see it having issues with more modern printers.
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

Tags for this Thread

Posting Permissions

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