Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Print edit screen functions Print edit screen functions
Previous
 
Next
New Post
3/16/2007 4:32 PM
 

I have a module that has many 'Edit' screens on one of those I need to pull up the info in it in a seperate window and applly a different style sheet for printing - (takes out all the wierd stuff and shows other stuff ) whats really the best way to do this ?

TIA


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
3/16/2007 8:17 PM
 

I just went through the same search for a good solution for a custom module I'm almost ready to release.

I have never liked using the DNN print skinobject as it places the print view into a pop-up window.  Most users (self included) run with one or more pop-up blockers turned on.  I was constantly getting user complaints that clicking the DNN print icon in several DNN sites I manage resulted in a page refresh but no print view.  Also, the standard DNN print skin-object does not pass querystring parameters often resulting in a loss of the information filtering the user had set up.

There are a couple of free replacements for the print skin object - DNN Jungle's PagePrint/TemplatePrint Skin comes to mind. It is available at http://dnnjungle.vmasanas.net/Home/tabid/1/Default.aspx and takes care of the querystring problems.

One of the keys to solving the problem is to come up with a css style sheet (contained in module.css) that properly handles the page formatting (as much as possible - page length/breaks is still a real problem) and especially the hiding of controls etc. If you not already familiar with it, look into the use of @Media Print and @Media Screen. Here are a couple of helpful articles on css for printing:

http://meyerweb.com/eric/articles/webrev/200001.html
http://css-discuss.incutio.com/?page=PrintStylesheets

I finally decided to look at how DNN selects the No Skin.ascx skin and No Container.ascx container to create the pop-up print window and modify this basic technique to write a custom printing solution that would display the print view in the current window, properly pass the querystring parameters to my module's print control which would then generate the same data (using nested DataLists) in a print optimized format.  Here's a bit of code that makes use of DNN's (undocumented?) capability of specifying a skin in the SkinSrc parameter and the module's container in the ContainerSrc parameter of the querystring:

Function to return url for module's print hyperlink:

Protected Function PrintURL() As String   
    Return NavigateURL(Me.TabId, "print", GetNavigationParams(True))
End Function

Function to generate querystring parameters including those for print view if Print parameter is true:

Protected Function GetNavigationParams(ByVal Print As Boolean) As String()
   Dim params As New ArrayList
   Dim result As String()
   If RequestID <> -1 Then params.Add("requestid=" & RequestID.ToString)
   If PostID <> -1 Then params.Add("postid=" & PostID.ToString)
   If AuthorID <> -1 Then params.Add("authorid=" & AuthorID.ToString)
   If PageSize <> MyConfiguration.PageSize Then params.Add("pagesize=" & PageSize.ToString)
   If CurrentPage <> 1 Then params.Add("currentpage=" & CurrentPage.ToString)
   If RequestType <> -1 Then params.Add("type=" & RequestType.ToString)
   If Category > 0 Then params.Add("category=" & Category.ToString)
   If DateRange < 1 Then params.Add("daterange=" & DateRange.ToString)
   If Status > 0 Then params.Add("status=" & Status.ToString)
   If OrderBy <> "Order_Date_DESC" Then params.Add("orderby=" & OrderBy)
   If Print Then
         params.Add("mid=" & ModuleId.ToString)
         params.Add("SkinSrc=" & DotNetNuke.Common.Globals.QueryStringEncode((("[G]" & _
Skins.SkinInfo.RootSkin) & "/_default/No Skin"))) params.Add("ContainerSrc=" & DotNetNuke.Common.Globals.QueryStringEncode((("[G]" & _
Skins.SkinInfo.RootContainer) & "/_default/No Container"))) End If result = CType(params.ToArray(GetType(String)), String()) Return result End Function

 This all seems to work well but I feel that the ultimate and much needed solution is for DNN core to eventually provide built-in pdf creation capabilities, particularly html to pdf.  I've also written (for another DNN site) a PDF Generator object that builds upon the open source iTextSharp project to define via xml configuration file(s) a report that is based around a datagrid like section with column data being generated either from a datasource object, sproc name or database SQL command text. One day I'll get around to extending it for other purposes . . .


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
3/17/2007 1:36 AM
 

Bbill - sounds exaxtly like what I need to do and the problems I am having - heres an interesting solution I kind of worked on today after I posted this

Years ago I ran across this on DynamicDrive (http://www.dynamicdrive.com/dynamicindex9/printstyle.htm) and its still there -

Basically it lets you specify a seperate url to print so your  function here to pass url info to it will be useful - now how to add it to the stylesheet etc.?

Be careful with iTextSharp - I had tons of problems getting it to render HTML correctly - if you had better luck please post an example somewhere so I can look at it - when i used it my PDFs loked so crapy i finally ditched it


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
3/17/2007 1:54 AM
 

well - not sure if this works but i did this bit of code

 Dim myPrint As Literal = New Literal
 myPrint.Text = "<link rel=alternate media=print href="http://www.yahoo.com">"
 Page.FindControl("StylePlaceholder").Controls.Add(myPrint)

 

And it does add the right stuff to the head of the page - so now its just passing the url info so it adds the right skin and css stuff and url info

well it seems this isnt used if i just hit the print button -

 Change StylePlaceHolder to CSS in the above code and it works


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Print edit screen functions Print edit screen functions


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out