Hello!
I want to provide the ability to allow pagesetup for customers using
PrintingSystem.PageSetup()
after that iam able to get all page info on this dialog but not the papersource and the printername
How can i determine printer name and papersource without actually printing something.
I want to provide some preconfiguration and to save settings th euser is able to make.
br
roland
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello Roland,
As for the capability to specify the printer name for your report, you can adjust it via the XtraReport.PrintingSystem.PageSettings.PrinterName property. As for more detailed printer settings like a paper source, you can invoke a standard PrintDialog and store all setting, preferred by the end-user and use them during actual printing. Hope this makes sense.
Thank you,
Valery
hi
what i want to achieve is that
br
roland
ps.: this is some kind of urgend and should work properly
Hello Roland,
I'm sorry to disappoint you, but I'm afraid that currently there is no easy way to accomplish this task. Basically, we're using a standard .Net page setup and dialog, but in the current version of the suite, these settings aren't saved anywhere. However, you can manually retrieve and store these settings before and after calling the ShowPreviewDialog method. Alternatively, if you are calling the ShowPreview method, you need to subscribe to the form's print preview closing event. You can refer to the sample code posted within the following thread: Serialisation - How to Save/load the settings made in a PrintPreview Dialog.
Also, note that we have the following suggestion registered in our database: Serialization - Add methods to save/load printer settings to Registry/XML/Stream.
If you find it useful, you can increase its popularity by tracking it. Then, you'll be notified when its status is changed.
Thank you,
Valery
Hi Valery.
The approach you pointed me to is not exactly what i want.
What i want is to set some page settings and a printer and a tray to my report before create document or print reliably.
So when i show the preview the report is already useing the new page settings.
This task should not be that complicated because a printing library should actually be able to handle printers and theirs settings properly.
br
roland
Valery
Now i found out how to reliable (so that my presets are reflected in preview and print) set some printersettings to my reports.
PageSettings ps = new PageSettings();
PrinterSettings pr = new PrinterSettings();
PageSetupDialog psd = new PageSetupDialog();
psd.PageSettings = ps;
psd.PrinterSettings = pr;
psd.ShowDialog(this);
XtraReport1 xr = new XtraReport1();
xr.PaperKind = ps.PaperSize.Kind;
if (xr.PaperKind == PaperKind.Custom)
{
xr.ReportUnit = DevExpress.XtraReports.UI.ReportUnit.HundredthsOfAnInch;
xr.PageSize = new Size(ps.PaperSize.Width, ps.PaperSize.Height);
}
xr.Margins = ps.Margins;
xr.Landscape = ps.Landscape;
xr.PrinterName = pr.PrinterName;
//Where to set the PaperSource ???
xr.ShowPreviewDialog();
It was a little bit strange for me that (all before create document)
br
roland
Hello Roland,
Thank you for the code snippet. Your approach seem to be quite correct. As for you questions:
1, 2) When a report document is generated the PritingSystem is recreated once again (or created if the report document is generated for the first time). That's why the XtraReport instance property values are mapped to the corresponding PrintingSystem instance property values (Landscape, PaperKind, PrinterName, etc.). Thus, settings applied to the PrintingSystem are not reflected in Print Preview. You should configure the necessary settings on the XtraReport basis. Then call the XtraReport.CreateDocument() (or XtraReport.ShowPreviewDialog() if the report document is generated for the first time). In this scenario your settings will take effect.
3, 4) The standard approach to accomplishing this task in the XtraPrinting Library is to handle the XtraReport.PrintingSystem.StartPrint event and adjust all necessary printing settings based on your requirements. I suggest that you review the How to dynamically select the paper source and set the printer resolution example, demonstrating this approach in action. I hope you'll find this information helpful.
Thanks,
Alessandro.
Hi
attached a testproject
now i have the problem jthat im able to save/load printersettings and pagesettings.
im able to show a preview properly (no in my real prject im not using show preview)
im NOT able to print with theese settings.
button 1 prints a two page report (actually does nothing to pagesettings)
button 2 prints a one page empty report.
Whats the problem here with printing?
This is URGENT and i think it should be possible to apply page and printersettings and then actually print the report properly.
br
roland
Hi!
I finally figured it out how to acomplish this task (mostly by trying all possiblities).
Now im using the startprint event as i found no other posibility.
.Net PageSettings and PrinterSettings are not XML Serializable so i wrote a wrapper.
Attached a working solution.
A documentation when the printingsystem is reset and a posiblity to set PrintSettings and PageSettings as a reports property which is then recognized in preview, export and print would be nice.
br
roland
sorry for the harsh tone yesterday