private void button4_Click(object sender, EventArgs e) { PaperSize pkCustomSize = new PaperSize("First Custom Size", publicCommon.getyc(42), publicCommon.getyc(29.7)); PDoc2.DefaultPageSettings.PaperSize = pkCustomSize; ((System.Windows.Forms.Form)Pvd).StartPosition = FormStartPosition.CenterScreen; ((System.Windows.Forms.Form)Pvd).Width = publicCommon.getyc(42); ((System.Windows.Forms.Form)Pvd).Height = publicCommon.getyc(29.7); ((System.Windows.Forms.Form)Pvd).Icon = this.Icon; Pvd.Document = PDoc2; if (PublicCommon.str_print != "1") { Pvd.ShowDialog(); } else { PDoc2.Print(); } }