Winform Reports for .NET
   Home
   Product Comparison
   Products
     PrintForm .NET
     PrintControls .NET
     PrintAdapters .NET
     PrintPreviewDialog .NET
     Localizer ASP.NET
     WebExtenders ASP.NET
   Downloads
     Free Trial Versions
     Upgrades
   Documents & Papers
   Purchase
   Support Index
   Press Releases
   Contact Us
   Privacy Statement
Enter your email and click 'Join List' to be kept up to date with latest releases and Tips and Tricks...

 
Click here to take the PrintForm.NET Tour
Note: the PrintForm walkthrough requires a Java Plug-in of version 1.3.1 or above. To view the walkthrough now click here.
Go to TMG Development Ltd Website
Microsoft Certified Partner

PrintForm FAQ for Versions 2.0.1.6 and Earlier

ID: W3200001

 

Installation and Getting Started
  Are there any prerequisites for installing PrintForm.NET?
  How do I add a PrintForm component to my Form?

Licensing
  When I received my Product License Code by email it was split over two lines - what does this mean?
  I've entered my license code but I still get a licensing exception when I run my program ("An unhandled exception of type 'System.ComponentModel.LicenseException' occurred in system.dll ..." etc)

Customising the Printed Output
  Adding Headers and Footers
  Making Controls invisible at Print time
  Setting an alternate BackColor at Print time

Distributing PrintForm with Your Application
  PrintForm files to distribute at runtime

Common Problems
  I've entered my license code but I still get a licensing exception when I run my program ("An unhandled exception of type 'System.ComponentModel.LicenseException' occurred in system.dll ..." etc)
  When I call PrintPreviewDialog.ShowDialog() I get an empty window saying: "This document does not contain any pages"
  When I call PrintPreviewDialog.ShowDialog() I get an unhandled exception with the following text: "An unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will be shut down immediately. The BodyContainer property of [PrintDocument document] has not been set."
  How do I make my form come out white at print (or print preview) time?
  Some of the controls on my Form aren't displayed at print (or print preview) time, or are 'empty'
  When I upgraded to PrintForm v2 I got an error when I tried to rebuild my project similar to the following: "Reference required to assembly 'PrintChaining' containing the implemented interface 'TMGDevelopment.Printing.IChainedDocument'. Add one to your project."
  I get a Licensing Exception when I run a managed Visual C++ application using PrintForm


General PrintForm Programming Issues
  -> See the PrintForm 'How do I ... ?' question and answer list

 

Top of PageInstallation and Getting Started


Are there any prerequisites for installing PrintForm.NET?
You need the .NET runtime Release 1. When installing you must be logged in as an Administrator.

How do I add a PrintForm component to my Form?
After you have installed the PrintForm component you will need to add it to your toolbox so that you can then drop it onto your Form. The following procedure describes how to do this:
1) Open the Visual Studio .NET editor.
2) Right click on the 'General' tab of the Toolbox, and select 'Customise Toolbox...'. (You may alternatively add it to the Windows Forms tab, or create a new tab).
3) Select the .NET Framework Components tab of the Customise Toolbox Dialog and scroll down until you find 'PrintForm'; check this and click OK.
You should now be able to drag a PrintForm component from the General Tab of the Toolbox onto your Form's Component tray.

Top of PageLicensing


When I received my Product License Code by email it was split over two lines - what does this mean?

The product license code you have received is valid, but can sometimes be wrapped onto a second line when displayed in your email program. You must treat both lines of the key as a single block. If you accidentally only entered part of the code into PrintForm during the installation process you can manually enter it again by going to the Start Menu > PrintForm Printing for .NET > Register PrintForm. Then we recommend you cut and paste the first line from the email into the textbox then cut and paste the final part of the key from th e second line on the end - make sure there is no space between them. (See also item 1 below if you are using Outlook XP - it may be corrupting the text in your email).

I've entered my license code but I still get a licensing exception when I run my program
If after installing the full (or hardware locked) version of PrintForm and entering your Product License Code (see registration faq) you still get a licensing exception when you run your application it is most likely due to one of the following:
1) You may be reading your email using Outlook XP. There is a bug in Outlook XP (MSKB:Q287816) which causes the Product License Code line to become corrupted. To resolve this click on 'Format-Unwrap Text' on the menu bar, or click on the link at the top of the email that says 'Extra line breaks in this message were removed. To restore, click here', and try entering the License Code again.
2) There is a bug in Visual Studio .NET 2002 causing this kind of problem with projects or solutions that have spaces in their names. Make sure your solution and project names don't contain any spaces.
3) Visual Studio .NET sometimes caches invalid licensing information (ie it may still be using the Trial version license). To resolve this close all the windows in Visual Studio .NET and do a rebuild all of your project.
4) If none of the above succeed it is possible that the licenses.licx file in your project folder has lost its reference to PrintForm - we have noticed that VS.NET removes them sometimes for no good reason. Open the file in a text editor and check that it has a line that looks something like:
TMGDevelopment.PrintForm.PrintForm, PrintForm, Version=*.*.*.*, Culture=neutral, PublicKeyToken=cb51e09df98aa227
(where the *.*.*.* denotes your printform version). If it does not you can add this line in manually or copy it from another project's licenses.licx file.
Advanced:
1) It is also possible to get this kind of licensing error if you build Forms referencing PrintForm into a class library (.dll) project. In this case it is the calling application (the .exe) that must be able to supply the PrintForm license, and unless the exe itself has a reference to PrintForm the compiler won't bind the PrintForm license into the exe. The simplest solution here is to add a PrintForm component to one of the Forms in your main application, which will cause the correct entry to be added to the licenses.licx file. Alternatively you can add a line containing 'TMGDevelopment.PrintForm.PrintForm, PrintForm' (without the quotes) to your project's licenses.licx file manually.
2) If you are working in managed C++ you will need to ensure the license is bound in manually by following the procedure detailed below under 'I get a Licensing Exception when I run a managed Visual C++ application using PrintForm'.

Top of PageCustomising the Printed Output


Adding Headers and Footers

To add a header or footer to your printout, create a Panel on your Form and set it's Visible property to False. Add controls as required to the Panel and then set the HeaderContainer (or FooterContainer) property of the PrintForm component to point at your Panel. When you print or print preview the Form the panels will be displayed in the margin area above and below the body of the page. (Note you can use any control as the HeaderContainer, but the Panel makes a convenient container for positioning constituent controls eg a Logo Picture and a date/time label). We also refer you to the samples provided with PrintForm for further information.

Making Controls invisible at Print time
To make a control invisible at print time, select the control and set it's VisibleAtPrinttime property to False. We also refer you to the samples provided with PrintForm for further information.

Setting an alternate BackColor at Print time
To alter the Background Color of any control at print (or print preview) time set the BackColorWhilePrinting property of the control to the desired color. We also refer you to the samples provided with PrintForm for further information.

Top of PageDistributing PrintForm with Your Application


PrintForm files to distribute at runtime
You need to distribute the printform and printchaining assemblies with your application. There are several ways to locate the correct assemblies:
1. The easiest way to do this is to build an installer project for your app and it will automatically pull in the correct versions.
2. Another way is to set copy local to true for the printform and printchaining references in your project, this will cause vs.net to copy them through to your bin directory and you can pick them up from there with your .exe and copy them to the same location as your exe on the target machine.
3. The final way is to copy them manually from their instralled locations under Program Files on your development machine, which are usually:
C:\Program Files\TMG Development Ltd\PrintForm Printing Component\bin\printform.dll
C:\Program Files\Common Files\TMG Development Ltd\PrintChaining\1.0.0.0\printchaining.dll

Whichever way you do it, you only need these 2 dlls, and they need to go in the same forlder as your application exe on the target machine.

Top of PageCommon Problems


When I call PrintPreviewDialog.ShowDialog() I get an empty window saying: "This document does not contain any pages"

Make sure that the PrintPreviewDialog.Document property is set to your PrintForm control.

When I call PrintPreviewDialog.ShowDialog() I get an unhandled exception with the following text: "An unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will be shut down immediately. The BodyContainer property of [PrintDocument document] has not been set."
You must set the BodyContainer property of PrintForm to the container control you wish to print (eg Form, Panel etc), otherwise PrintForm has nothing to render at print time and raises this exception to notify you.

How do I make my form come out white at print (or print preview) time?
To alter the Background Color of any control at print (or print preview) time set the BackColorWhilePrinting property of the control to the desired color. We also refer you to the samples provided with PrintForm for further information.

Some of the controls on my Form aren't displayed at print (or print preview) time, or are 'empty'
Some controls in .NET and some third party controls are not fully managed or are not written according to the .NET control guidelines, as a result they need to be marked as 'Legacy' controls in order for PrintForm to correctly print them. To do this select the control in question in Visual Studio .NET and set it's UseLegacyPrinting property to true. This will resolve the problem in most cases.

When I upgraded to PrintForm v2 I got an error when I tried to rebuild my project similar to the following: "Reference required to assembly 'PrintChaining' containing the implemented interface 'TMGDevelopment.Printing.IChainedDocument'. Add one to your project."
PrintForm from version 2.0 onwards has a dependency on the extra shared assembly PrintChaining.dll. To recompile your project you must add a reference to PrintChaining to your project: right click on 'References' in the Solution Explorer>select 'Add Reference'>on the .NET tab scroll down and select PrintChaining. You will also need to deploy PrintChaining.dll with your application that uses PrintForm.

I get a Licensing Exception when I run a managed Visual C++ application using PrintForm
Unfortunately C++ in Visual Studio 2019 doesn't provide nearly as much support for the .NET component licensing process as C# or VB.NET, with regard to creating the licenses file for a licensed control and binding it into the executable - you have to do most of it yourself. Here are the steps you must follow:
1. Open a Visual Studio 2019 command prompt
2. Change directory to your project folder (where the licenses.licx file is)
3. Run the following command to generate the .licenses file
lc /target:<your exe filename.exe> /complist:licenses.licx /i:PrintForm.dll
4. This generates a file called <your exe filename.exe>.licenses in the project folder
5. In Visual Studio, right click on the project in the Solution Explorer and select Properties>Linker>Input>Embed Managed Resource File and enter the filename of the .licenses file
6. When you rebuild the solution the .licenses file will be embedded in the .exe manifest and the component should be able to read it at runtime
Note: you only need to generate this once for a given project, but it is specific to the project (the licenses file contains a reference to <your exe filename.exe> and won't work with any other project.