vikbehal
vikbehal

Reputation: 1524

ASP.NET: Print functionality

I've a big form with below mentioned fields/controls:

  1. SharePoint Peoplepicker
  2. SharePoint DateTime control
  3. TextBox Single/Multiline
  4. Dropdowns
  5. GridViews

I'm looking for a solution to print this form. Output print should be clean to ensure everything looks like labels while printing. If I change CSS e.g. for textbox, there are limitations viz. not all data of textbox would be visible. Is there a way to achieve this without having to do following:

  1. Have Labels and show them while printing for each control
  2. Convert gridviews with itemtemplate and have labels in template while printing.

Another requirement is to ensure that form fits in A4 paper.

Upvotes: 0

Views: 256

Answers (1)

user7316396
user7316396

Reputation:

I had similar assignment & I completed using below approach:

  1. Create a 'Print preview' button which on click opens a dialog
  2. Once dialog opens, run JavaScript/jQuery to clone your container & convert controls into static values - Each controls' values would be in span or control itself; Everything else but the span containing the value can be removed
  3. Extra controls like row numbers in grid, warning messages, buttons or similar can be removed
  4. Remove extra padding, margins & font size can further be reduced to fit A4 e.g. 8pt
  5. Finally provide a 'Print' button which takes parent container & prints- You can use printThis.js for this

Upvotes: 1

Related Questions