Reputation: 440
In my c# program there is a section that prints picktickets using Crystal reports. The report saves the data as a pdf. there is a reason why it needs to go to PDF and not just print straight to a printer.
I want to be sure that when printdocument executes it does not perform a fit to page. I did look around and even asked LLM, but nothing was clear. When I look at a print settings screen I can see an option 'Actual Size' and when I switch between that and 'fit to printable area' I can see the page change size in preview.
It is that line marked in yellow I want to emulate when calling print document.
PrinterSettings printerSettings = new PrinterSettings();
System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings(printerSettings);
printerSettings.PrinterName = toPrinter;
printerSettings.Duplex = Duplex.Simplex;
//printerSettings.FromPage = 1;
//printerSettings.ToPage = 3;
PaperSource ps = new PaperSource();
ps.RawKind = (int)PaperSourceKind.Middle;
printerSettings.DefaultPageSettings.PaperSource = ps;
PrintDocument printDocument = document.CreatePrintDocument();
printDocument.PrinterSettings = printerSettings;
printDocument.PrintController = new StandardPrintController();
PrintingPermission perm = new PrintingPermission(System.Security.Permissions.PermissionState.Unrestricted);
perm.Level = PrintingPermissionLevel.AllPrinting;
// Something here to set "Actual Size"
// The Big MOMENT!!!
printDocument.Print();
Upvotes: 1
Views: 235