This is a migrated thread and some comments may be shown as answers.

Printing and Print Preview

3 Answers 510 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
im
Top achievements
Rank 2
im asked on 06 Mar 2013, 06:31 PM

Is there a flag or argument that would differentiate the purpose in the IPrintable:PrintPage function.

I would like to modify what the print preview looks like as opposed to what is actually being sent to the printer. Our printers prints everything in Landscape, even though the the page orientation is Portrait. (yes its a specialized printer) . So I would like the user to be able to read it on the screen in Horizontal, but when I send it to the printer itself, Id like the text to be Vertical.

For PrintPreview I am using the RadGdiGraphics, and Telerik.WinControls.Primitives.TextParams. 

Currently I have it set as  

tp.textOrientation = Orientation.Vertical

Which is what needs to be sent to the printer, but for print preview I would like

tp.textOrientation = Orientation.Horizontal

-------

Could this be accomplished using a PrintController. I've see limited documentation on that, and no examples, or explanation of exactly what it does, or allow you to programatically control.

Thanks in advance.


3 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 11 Mar 2013, 01:08 PM
Hi Derek,

Thank you for writing.

You can achieve your goal by inheriting from RadPrintPreviewDialog and overriding the OnShowPrintDialog method. This method is called when the user clicks the print button. There you can change the Landscape property of the printed document. Here is the code you can use:
public class MyPrintPreviewDialog : RadPrintPreviewDialog
{
    protected override void OnShowPrintDialog()
    {
        this.Document.DefaultPageSettings.Landscape = false;
 
        base.OnShowPrintDialog();
    }
}

To show your dialog you should use the following snippet:
MyPrintPreviewDialog dialog = new MyPrintPreviewDialog();
RadPrintDocument doc = new RadPrintDocument();
doc.AssociatedObject = iPrintableInstance;
doc.DefaultPageSettings.Landscape = true;
dialog.Document = doc;
dialog.ShowDialog();

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
im
Top achievements
Rank 2
answered on 11 Mar 2013, 11:47 PM
This seems to work out ok, theres a couple things I need to look into, somewhere between the initiation of the PrintPreview, and then the actual printing, it seems like the page sizes are changing somehow (even though I want it to per page, just not 2 different sizes for the same page). I need to look into that I wishe I could hook when it changes somehow to help track it down.

The other really specialized question, which probably no one has ever asked or would need but me, could I display different pages sizes within a print preview? I dont mean just change the page size so the UI reflects it, I mean the first page might be 4 inched long, the second page being 2 inches, third page being 5inches ???? (A ruler on the print preview would REALLY be helpful for my application hint hint :) )

I know thats kindof bizarre, but our printers have a continous feed of material, and it cuts it to the length specified by the page size, so one print job or document can have each page be different sizes if the user would like.

Thanks

Derek
0
Ivan Petrov
Telerik team
answered on 14 Mar 2013, 02:29 PM
Hello Derek,

Thank you for writing.

Can you please elaborate a bit more on your first question? What is the change you observe, how does it affect the print job?

The page size can be changed only at document level. That is you can set a page size but it will be used for all pages inside a document - you cannot specify individual page sizes.

As for the ruler you can see our response in your ticket titled "Printing RadPrintDocument".

I hope this helps. Feel free to write back with any further questions.

Kind regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
General Discussions
Asked by
im
Top achievements
Rank 2
Answers by
Ivan Petrov
Telerik team
im
Top achievements
Rank 2
Share this question
or