Print using Word Interop

viral patel 1 Reputation point
2021-06-09T11:32:52.667+00:00

Hi Team,

We are using Word Interop in C# application to print word document.

While word document printing we are getting some alert like "your margines are pretty small, some of your content might be cutt off".

If we ingnore this warning then there will be a possible cutt off in printed TIF Images.

My Question is,

  • Can i identify this warning from code like when i print a document then after i wanted to mark that document with a possible cutt off, how can i add this at my code level to identify printing will execute with possible cutt off.

Please advise.

Thanks

{count} votes

1 answer

Sort by: Most helpful
  1. David 151 Reputation points
    2022-02-11T09:55:01.617+00:00

    Not sure if you can get the warning from code, but you may be interested in printing Word document on a custom paper size.

    using Spire.Doc;
    using System.Drawing.Printing;
    
    namespace PrintWord
    {
        class Program
        {
            static void Main(string[] args)
            {
                 //Instantiate a Document object.
                Document doc = new Document();
    
                //Load the document
                doc.LoadFromFile(@"Sample.docx");
    
                //Get the PrintDocument object
                PrintDocument printDoc = doc.PrintDocument;
    
                //Customize the paper size
                printDoc.DefaultPageSettings.PaperSize = new PaperSize("custom", 900, 800);
    
                //Print the document
                printDoc.Print();
    
            }
        }
    

    More information can be found: https://www.e-iceblue.com/Tutorials/NET/Spire.Doc/Program-Guide/Print/C-/VB.NET-How-to-Print-Word-on-a-Custom-Paper-Size.html

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.