You must Sign In to post a response.
  • Category: .NET

    Reg Printing Issue - C#

    Hi All,

    Am generating PDF document using iTextsharp dll and when am printing that document programmatically some text in the header or right corner gets cutted off.

    When I open the PDF and print manually instead of programmatic print it works fine.

    Could you please help out in resolving this issue. Thank you.

    My code details for printing:

    PrinterSettings obj = new PrinterSettings ();
    obj.PrinterName = "Printer1";

    ProcessStartInfo info = new ProcessStartInfo(@"C:\PDFOutput\File1.pdf");
    info.verb ="Print"
    info.CreateNoWindow = true;
    info.windowstyle = ProcessWindowStyle.Hidden;
    Process p = new Process();
    p.StartInfo = info;
    p.Start();
  • #762923
    Hello Mahe,

    You should use two methods two define page size in iTextSharp.dll
    Method 2 :--> Rectangle rec = new Rectangle(144, 720);
    // 72 points = 1 inch / 144 points = 2 inches / 720 points = 10 inches

    Method 2 :--> Rectangle rec2 = new Rectangle(PageSize.A4);

    Document doc = new Document(rec);
    Or
    Document doc = new Document(rec2);

    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


Sign In to post your comments