Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
hello everybody

iam creating a cheque print application i have like 5 different cheque i set the custom design for each one of them in the printer and named each one of them the thing that i want to do i want to set the custom paper regarding to the selected cheque this is my code

C#
myReportDocument.PrintOptions.PrinterName = @"\\majid-pc\HP LaserJet P2015 PCL6";
           myReportDocument.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)GetPaperSize(@"\\majid-pc\HP LaserJet P2015 PCL6", "qiib");


C#
public Int32 GetPaperSize(String sPrinterName, String sPaperSizeName)
        {
            PrintDocument docPrintDoc = new PrintDocument();
            docPrintDoc.PrinterSettings.PrinterName = sPrinterName;
            for (int i = 0; i < docPrintDoc.PrinterSettings.PaperSizes.Count; i++)
            {
                int raw = docPrintDoc.PrinterSettings.PaperSizes[i].RawKind;
                if (docPrintDoc.PrinterSettings.PaperSizes[i].PaperName == sPaperSizeName)
                {
                    return raw;
                }
            }
            return 0;
        }


but its not working idk why i searched every where the crystal report viewer show me the correct design and layout but when i click print => printer select dialog pop up and the paper size is not my custom paper size idk why any help is going to be appreciated
Posted

1 solution

any help please for this issue
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900