CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2005
    Posts
    1,828

    Printing a document

    I have to develop an application that will print the document and based on the result whether the printing was a success or a failure should display the status.

    Some of the important futures are
    1) It will print multiple documents, the file and its location will be provided from a table in SQL Server.
    2) The files will be printed sequentially.
    3) The application will update the status of the document within the SQL Server database whether it was a success or failure.
    4) It should take the default drivers and print it

    How can I accompalish this? There might be numerous C# examples on internet available where you can print the document. But how can i get the status of that document whether it was a success or failure. Irrespective of whatever reason it failed to print?

    Thanks in Advance

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Printing a document

    Quote Originally Posted by maverick786us View Post
    How can I accompalish this? There might be numerous C# examples on internet available where you can print the document. But how can i get the status of that document whether it was a success or failure. Irrespective of whatever reason it failed to print?

    Thanks in Advance
    Depending on how you are printing the document, you either need to check the return value from the print method and/or catch exceptions.

  3. #3
    Join Date
    Apr 2005
    Posts
    1,828

    Re: Printing a document

    Quote Originally Posted by Arjay View Post
    Depending on how you are printing the document, you either need to check the return value from the print method and/or catch exceptions.
    Which print method is generally used that has a return value

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Printing a document

    Quote Originally Posted by maverick786us View Post
    Which print method is generally used that has a return value
    There are several ways to print, which way are you printing?

  5. #5
    Join Date
    Apr 2005
    Posts
    1,828

    Re: Printing a document

    A method in which you simply provides the path of the file and it prints that particular file

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Printing a document

    Quote Originally Posted by maverick786us View Post
    A method in which you simply provides the path of the file and it prints that particular file
    Without knowing exactly what you are doing, it's going to be hard to help, so good luck to you.

  7. #7
    Join Date
    Apr 2005
    Posts
    1,828

    Re: Printing a document

    I have a database which consist of a list of print documents, along with its path. Now my application will print those documents from the path specified and within that table will display the status, whether its a success or failure. In case if it was a failuer, it show display the reason why it failed. Hope this information is sufficient?

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Printing a document

    Quote Originally Posted by maverick786us View Post
    I have a database which consist of a list of print documents, along with its path. Now my application will print those documents from the path specified and within that table will display the status, whether its a success or failure. In case if it was a failuer, it show display the reason why it failed. Hope this information is sufficient?
    It isn't. Show some code.

    Look, the concept here is simple - check return codes and exceptions for errors. If the approach you are using doesn't return error codes or throw exceptions, use another approach.

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

Featured