Set Printer Delivery Extension Default Page Size

Posted on 2009-02-10
Last Modified: 2012-05-06
I have set up the sample Printer Delivery Extension as per the MSDN.
The Delivery code works but the page is printing in Letter size 8.5/11.5 inches
I wish the default size to be A4 21.0x29.7 cm.
I have changed the C#. as below.
Rebuilt the assembly and copied the to the reporting server, place the code in the correct folders, restarted IIS and Report Server.

The changed as seen on the subsciption page. Ie the new default sizes are 21.0 and 29.7, BUT the report still prints out in letter size.

Any Ideas?

              // Setting for page height
                    m_settings[1] = new Setting();
                    m_settings[1].Name = SubscriptionData.PAGEHEIGHT;
                    m_settings[1].ReadOnly = false;
                    m_settings[1].Required = true;
                    m_settings[1].Value = "29.7";

                    // Setting for page width
                    m_settings[2] = new Setting();
                    m_settings[2].Name = SubscriptionData.PAGEWIDTH;
                    m_settings[2].ReadOnly = false;
                    m_settings[2].Required = true;
                    m_settings[2].Value = "21.0";

 // Correctly format device info strings
                string pageWidth = data.pageWidth + "cm";
                string pageHeight = data.pageHeight + "cm";
                string deviceInfo;

and PrinterDeliveryUIProvidor.cs

        // Variables used to store information about the subscription being created
        private double m_pagewidth = 21.0;
        private double m_pageheight = 29.7;
        private ArrayList m_printers;

and subscriptiondata.cs

        // Initalize variables to default values
        public string Printer = "";
        public double pageHeight = 29.7;
        public double pageWidth = 21.0;

Question by:stevejknight

    Author Comment

    The report is set up as A4 in the desgner.
    It prints out fine from report manager using the print fucntion.
    LVL 26

    Expert Comment

    by:Anurag Thakur
    what is the default paper size for the printer check that - if its letter set to a4 and it will print fine

    Author Comment

    Default Printer Paper size is A4.
    As I mentioned before The report prints fine when printing from the Web Based reportserver viewer,
    Therefore it must have something to do with the Preinter delivery extension code.


    Accepted Solution

    To resolve this, I added the following code.
     // Method to draw the current emf memory stream
            private void ReportDrawPage(Graphics graphics)
                if (m_currentPageStream == null || m_currentPageStream.Length == 0 || m_metafile == null)

                // Set metafile delegate.
                int width = m_metafile.Width;
                int height= m_metafile.Height;
                m_delegate = new Graphics.EnumerateMetafileProc(MetafileCallback);
                // Draw in the rectangle
                Point destPoint = new Point(0, 0);
                System.Drawing.Rectangle rect = new
                System.Drawing.Rectangle(0, 0, width, height);
                graphics.EnumerateMetafile(m_metafile, rect, m_delegate);
                // Clean up
                m_delegate = null;


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now