Printing and Print Preview

4 posts, 0 answers
  1. im
    im avatar
    27 posts
    Member since:
    Mar 2012

    Posted 06 Mar 2013 Link to this post


    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.


  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 11 Mar 2013 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. im
    im avatar
    27 posts
    Member since:
    Mar 2012

    Posted 11 Mar 2013 Link to this post

    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
  5. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 14 Mar 2013 Link to this post

    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.
Back to Top