Results 1 to 8 of 8

Thread: [RESOLVED] How do I set print job document name?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    30

    Resolved [RESOLVED] How do I set print job document name?

    I am having difficulty setting the print job document name with VB6. I don't want to use the method of temporarily changing the app.name because 99% of the time I am running the program from the development environment.

    I managed to get the printer queue to show the document name I set by using the following method.

    Private DI As DOCINFO
    ...

    DI.lpszDocName = DocName
    job_id = StartDoc(Printer.hDc, DI)

    Now herein lies the problem.
    No matter what I do, once I have called the StartDoc function, the next command that sends data to the printer gives a 482 error. no matter if its printer.paintpicture or if its printer.print. program crashes every time. I have tried using setjob to correct the issue but I really have no idea how to use it properly. I have been looking for solutions to this problem but it seems like no solution exists. HELP!

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: How do I set print job document name?

    the next command that sends data to the printer
    And what would that command be? You don't show it.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    30

    Re: How do I set print job document name?

    Quote Originally Posted by SamOscarBrown View Post
    And what would that command be? You don't show it.
    Well any of the print commands anywhere throughout my program will cause the crash. Just for curiosity I put the following line directly after the startDoc command:

    Printer.Print "Moo"

    It crashed.

  4. #4
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: How do I set print job document name?

    This is what Microsoft says about that error:
    •You don't have a printer installed from the Windows Control Panel.
    Open the Control Panel, double-click the Printers icon, and choose Add Printer to install a printer.

    •Your printer isn't online.
    Physically switch the printer online.

    •Your printer is jammed or out of paper.
    Physically correct the problem.

    •You tried to print a form to a printer that can accept only text.
    Switch to an installed printer that can print graphics.
    So, if none of those apply, not sure the issue. Did the printer function work for you before you starting calling it by name?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    30

    Re: How do I set print job document name?

    Quote Originally Posted by SamOscarBrown View Post
    This is what Microsoft says about that error:


    So, if none of those apply, not sure the issue. Did the printer function work for you before you starting calling it by name?
    Yes if I just start sending printer commands and I don't call startDoc it works fine, and it has worked fine for the past 10 years.

  6. #6
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: How do I set print job document name?

    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    30

    Re: How do I set print job document name?

    Quote Originally Posted by jggtz View Post
    So it's a start. that method allowed me to send a job to a printer that had a document name and didn't crash.
    strangely tho when I select my Adobe PDF printer it spools the job and then it just disappears from the queue.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    30

    Re: How do I set print job document name?

    So from experimentation it seems that printer api calls and the printer.print function are not able to be mixed... If I call startdoc and then call WritePrinter and then call printer.print the printer queue contains two jobs (one titled "AAAAAA" from the writeprinter function and one called "Microsoft Visual Basic" from the printer.print function.

    Since my program has many thousands of printer calls using printer.print I'm not interested in making this change.

    So I will just have go on happily printing without a document name.

    Thanks to you both though.

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
  •  



Click Here to Expand Forum to Full Width