We help IT Professionals succeed at work.

Set Printer Delivery Extension Default Page Size

Medium Priority
1,603 Views
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?
Thanks


PrinterDeliveryProvidor.cs
              // 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;

Comment
Watch Question

Author

Commented:
PS
The report is set up as A4 in the desgner.
It prints out fine from report manager using the print fucntion.
Anurag ThakurTechnical Manager

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

Author

Commented:
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.

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)
                return;
            lock(this)
            {

            // 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;
           
            }

        }

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.