Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1587
  • Last Modified:

Set Printer Delivery Extension Default Page Size

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;

0
stevejknight
Asked:
stevejknight
  • 3
1 Solution
 
stevejknightAuthor Commented:
PS
The report is set up as A4 in the desgner.
It prints out fine from report manager using the print fucntion.
0
 
Anurag ThakurCommented:
what is the default paper size for the printer check that - if its letter set to a4 and it will print fine
0
 
stevejknightAuthor 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.

0
 
stevejknightAuthor Commented:
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;
           
            }

        }
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now