on 11-13-2008 4:31 PM
Hi there,
maybe someone encountered the same Problems I am facing.
I am setting the page margins for the Left-Side to have enough space to punch the printout.
Somehow CR seems to ignore the values I set when printing a Report.
Most of the times I have too much space on the right side and not on the left side.
The margin on the Left side seems to be the min-margin of the printer.
What`s wrong with the Reports?
-
CR 2008 with SP1 is used.
The Reports are not designed against a specific Printer.
The virtual Printerdriver of CR is used.
Greetz
Ricardo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I created a WinForm App using Visual Studio 2008 and Crystal Reports 2008 SP1.
Language is C#
Within my app I have Form that displays Reports using the CrystalReportsViewerControl.
I create Reportfiles in my Solution. At runtime they are displayed in the CrystalReportViewerControl.
The Layout especially regarding the page margins seems to be correct, but whenever I print the Report to a Printer (not a specific one) the page margin changes and on the left side I get a "min-margin"
and on the right side I get too much space.
It should be the other way because the printouts have to be punched on the left side.
I can change the page margins of the reportfiles but whenever I print the reports through the
ReportViewerControl or calling the "printtoprinter-method" the result is the same.
Why do the page-margins change in such way?
thanks in advance
-
I am not using the crystalreports the is ship with visual studio 2008.
I am using crystal reports 2008 SP1. The 12.x dlls
Now I'm in trouble, next year could be too far, I've hundreds of customers with dozens of different printers each one.
I've tried the workaround using reportappserver but other problems had born, like setting some properties of printers that don't work, settings that I can't set by code (and creating different printers for different settings in this universe isn't a solution at all) and an "automatic" scalling in dot matrix printers that I can't understand or control, this is the original problem with other printers before start using reportappserver.
There is no solution neither workaround that works for me, unfortunately I can't upgrade any more customers for version 2008.
Saramago
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Couple of things;
1) dot matrix printers
Careful with these. Crystal Reports only works with printer drivers that are Unicode compliant. A lot (most?) dot matrix printers fail here. So, do check with the printer manufacturer to see if the driver you are using is Unicode compliant. And for the most part, from my experience, Unicode compliant dot matrix printers are very slow in rendering pages sent from Crystal Reports. E.g.; in a nut shell, when you are printing a report, you are printing a graphic and dot matrix printers have always left a lot to be desired there.
2) You do not specify the issues you are running into, but it does look like there is a number of them. I would suggest creating a phone case and seeing if a technical support rep can help you out over the phone. Phone case can be created here:
Ludek
Hi,
I've the "same" problem with printer margin settings and I read that there is a Technical Escalation number 5000075234,
the SP2 was released after last post but the problem persists.
There is any fix ? Should we expect for the next service pack ? The answer will be in this thread ? Any idea when it will be solved ?
Best regards,
A. Saramago
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A quick fixpack would be essential.
Look, our customers can't print invoices, labels and so on because there are wrong margins. What should we tell them ?? Stop invoicing until May ?
Currently we stopped delivering our Software with Crystal Reports 2008 and switched back to an older Crystal Reports version. That whole thing is causing a lot of holine extra work. And unsatisfied users.
If a reporting tool doesnt print correct margins, it is simly unusable and everyone looking for a reporting component will have to choose some other.
Nothing I can do. The fix is in SP3, I saw it work with a test app my self. I don't think there is any possibility of this making a Fix Pack. You may want to talk to a technician over the phone, but am not sure if that will help either.
Phone cases can be created here;
As this is a bug, you will be refunded, but it is the only way to talk to someone and possibly apply more pressure on this to get the fix into an FP.
Ludek
Ludek,
Sorry to sound impatient but our software is supposed to be deployed January 7th so this workaround is critical for me. Any additional help?
Thanks,
Sandy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Just a reminder this is a community forum area and is not a case management system. If you would like access to a support Engineer to resolve your issue and work with you directly please purchase a case on line and one of our Engineers will work directly with you to resolve the issue.
Here's what the code would look like using C#:
System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptionsClass();
CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions MYPRTOpts = new PrintOptionsClass();
if (rdoCurrent.Checked)
{
pDoc.PrinterSettings.PrinterName = cboCurrentPrinters.Text;
MYPRTOpts.PrinterName = cboCurrentPrinters.Text;
MYPRTOpts.PaperSize = (CrPaperSizeEnum)
pDoc.PrinterSettings.PaperSizes[cboCurrentPaperSizes.SelectedIndex].Kind;
MYPRTOpts.PaperSource = (CrPaperSourceEnum)
pDoc.PrinterSettings.PaperSources[cboCurrentPaperTrays.SelectedIndex].Kind;
// added the below line to verify the changes work.
MYPRTOpts.PaperOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape;
// new API added to allow changing printing options
MYPRTOpts.DissociatePageSizeAndPrinterPaperSize = true;
MYPRTOpts.PageMargins.Left = 1;
MYPRTOpts.PageMargins.Right = 1;
MYPRTOpts.PageMargins.Top = 1;
MYPRTOpts.PageMargins.Bottom = 1;
}
else
....................
Thanks again
Don
Ludek,
Here is the code I tried to implement. In the code you provided what is margins.Leftmargin, etc..? With the code below, no matter what I set the margins, they print exactly the same (incorrectly) when sent to the printer: a very small left margin with a larger right margin. It seems to be ignoring the margins that are explicitly set in the code.
Public Sub print(ByVal Printer As String)
Dim prntSettings As New System.Drawing.Printing.PrinterSettings
Dim m_Report As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument
Dim prnOps As New CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions
Dim m_controller As CrystalDecisions.ReportAppServer.Controllers.PrintOutputController
m_Report = m_ReportDocument.ReportClientDocument
m_controller = m_Report.PrintOutputController
m_Report.VerifyDatabase()
If Printer = "" Then
Printer = prntSettings.PrinterName
End If
m_controller.ModifyPageMargins(1, 1, 1, 1)
m_controller.ModifyPrinterName(Printer)
m_controller.PrintReport(Nothing)
m_Report.Close()
m_ReportDocument.Close()
End Sub
Thank you for your help.
Sandy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good Morning,
I am having the same issue related to the page margins. I have tried both what Kjell Arne suggested and what Ludek suggested but am having no luck. Is there any update on the case number for this issue with R&D?
This is a big issue since our application developed uses Crystal Reports and has to align exactly with the report it was designed from. These reports have to be scanned by the State of Virginia Department of Motor Vehicles and have to be accurate to work correctly. The page margins are completely throwing off the alignment of the entire report.
If anyone else has any suggestions, please post. Any help is welcome.
Thanks,
Sandy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Don! The SP1 did the trick.
Will I need to update the Crystal Reports Runtime at the production server as a result of the SP1 upgrade?
The one I use is from [CR 2008 Runtime Package for the .NET Framework (EXE file)|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm]
The file is called cr120_redist_exe.zip size 25.885 kB.
This is how my (test) code ended up. I notice that the order is of importance. For example, if the lines doing
ModifyPrintOptions and
ModifyUserPaperSize switches place, it doesn't work.
Option Strict On
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page
Private rpt As ReportDocument
Private Sub ConfigureCrystalReports()
rpt = New ReportDocument()
Dim reportPath As String = Server.MapPath("Hierarchical Grouping.rpt")
rpt.Load(reportPath)
Dim myPrintOptions As CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions = _
CType(rpt.ReportClientDocument.PrintOutputController.GetPrintOptions(), _
CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions)
Dim newPrintOptions As CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions = myPrintOptions.Clone(True)
newPrintOptions.DissociatePageSizeAndPrinterPaperSize = True
rpt.ReportClientDocument.PrintOutputController.ModifyPrintOptions(newPrintOptions)
rpt.ReportClientDocument.PrintOutputController.ModifyUserPaperSize(40400, 40400)
myCrystalReportViewer.ReportSource = rpt
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
ConfigureCrystalReports()
End Sub
End Class
So Ricardo, if you copy my code and then play around with myPrintOptions.PageMargins, maybe you can figure out something that works.
(I usually make a smallest possible application to test out my problem. When it works, I introduce it into the main application).
- Kjell Arne
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
it is really important to find a way to repair the reports.
I am having more and more trouble with my customers about this case.
So please help
Regards
Ricardo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have a possible work-around. The work-around uses the InProc RAS and the code would be something like this:
Dim rcd As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument
rcd = crReportDocument.ReportClientDocument
Dim prnOpts As CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions
Dim poc As CrystalDecisions.ReportAppServer.Controllers.PrintOutputController
poc = rcd.PrintOutputController
poc.ModifyPageMargins(margins.leftMargin, margins.rightMargin, margins.topMargin, margins.bottomMargin)
poc.PrintReport(Nothing)
You need to add reference to these assemblies:
crystaldecisions.reportappserver.clientdoc
crystaldecisions.reportappserver.controllers
crystaldecisions.reportappserver.datadefmodel
crystaldecisions.reportappserver.reportdefmodel
Here is an article that contains more info on how to work with InProc RAS:
Ludek
Anyone out there who encountered the same problems?
I´m also trying to set the page margins programatically at runtime using the "ReportDocument.PrintOptions.ApplyPageMargins(CrystalDesicions.Shared.PageMargins)" method.
This also does not work correctly when printing the report using the print button of the CrystalReportViewer-Control.
Anyone has clue?
kind regards
Ricardo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ricardo,
There is a new API that allows you to dissociate the printer... that is by default not checked on in the Report file.
Try setting it to true in your app and test again:
// new API added to allow changing printing options
newOpts.DissociatePageSizeAndPrinterPaperSize = true;
Search the Object Browser for how to use it.
Thank you
Don
Hi Don,
thanks for your help, but this also didn`t resolve my problem.
The strange thing is, that when using the export function of the CrystalReportsViewerComponent, exporting the Report to PDF or RPT and then printing the PDF or the RPT in the Report Designer, all works just fine or as expected.
When exporting to Word and trying to print, Word tells me that the page margins are outside of the printable area. This is strange because everything fits well for the Paper Size A4.
Any other ideas?
I really don´t know any further. I also created new reports to see if there is something wrong
with other reportfiles, but the problem stays the same.
regards
Ricardo
This looks like an issue we'll need to report to R&D. I was able to reproduce it as follows:
Create a new report, set the margin. On this new report, the margin printed as expected from a .NET app. I then changed to a non default printer driver. Now the margins were ignored. I set the rep[rot back to the default printer driver, still no margins. Looks like as soon as there is any change done to the printer drivers in the CR designer (and possibly at runtime - need more testing), the margin info is lost and can never be set again - at least I was not able to set it. Essentially I have a broken report.
Once the above has a track number assigned, I'll post it here.
Ludek
The issue was confirmed as a problem that R&D needs to look at. At this time I'm waiting for R&D to duplicate and accept the escalation. Once that is done, we're typically looking at 6+ months for a fix to be rolled into a service pack, though there is the possibility that a fix can come out in a "hot fix" sooner.
Ludek
Hi Ludek,
thanks for the Info.
Since this case may take a while at your R&D is there any possibility to fix the "broken" Reports?
If not, does it mean that I have to redesign or recreate the broken reports?
I'm asking because if I have to recreate those Reportfiles I am facing to recreate about 63 Reportfiles out of over 200. This is a lot of work to do.
Thanks a lot for helping.
Regards Ricardo
Hi,
We have the same problem, the margin is lost in many reports.
If we set DefaultPaperSize option it will work on our Xerox printers, but it doesen't solve the problem on all printers (a customer reported problem with a HP Laserjet printer).
reportDocument.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize;
For us it's very importent that we can find a way to repair the broken reports.
Rgds,
Lars
>
> Hi Ricardo,
>
> There is a new API that allows you to dissociate the printer... that is by default not checked on in the Report file.
>
> Try setting it to true in your app and test again:
>
> // new API added to allow changing printing options
> newOpts.DissociatePageSizeAndPrinterPaperSize = true;
>
> Search the Object Browser for how to use it.
>
> Thank you
> Don
Don (or anyone else),
I try to get to the DissociatePageSizeAndPrinterPaperSize but I can't figure out how to access it.
I use CR 2008 with Visual Studio 2005, Visual Basic. My goal is to get an unrestricted right hand side
of my report, so I can have as many columns as I want. (I have a different thread about this).
First of all: If I search DissociatePageSizeAndPrinterPaperSize in the Object Browser, it can't find it.
(I have performed an upgrade for CR XI R2 to CR 2008 and it seemingly went well).
Here is what I do in code (a modified web download for testing):
Option Strict On
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page
Private rpt As ReportDocument
Private exportPath As String
Private myDiskFileDestinationOptions As DiskFileDestinationOptions
Private myExportOptions As ExportOptions
Private selectedNoFormat As Boolean = False
Private Sub ConfigureCrystalReports()
rpt = New ReportDocument()
Dim reportPath As String = Server.MapPath("Hierarchical Grouping.rpt")
rpt.Load(reportPath)
Dim myPrintOptions As CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions = _
CType(rpt.ReportClientDocument.PrintOutputController.GetPrintOptions(), _
CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions)
Dim newPrintOptions As CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions = myPrintOptions.Clone(True)
Dim newMargins As CrystalDecisions.ReportAppServer.ReportDefModel.PageMargins = newPrintOptions.PageMargins
newPrintOptions.PageMargins = newMargins
newMargins.Right = 1000
'newPrintOptions.PaperSize = CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperSizeEnum.crPaperSizePaperA3
' newPrintOptions.PaperOrientation = CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperOrientationEnum.crPaperOrientationLandscape
rpt.ReportClientDocument.PrintOutputController.ModifyPrintOptions(newPrintOptions)
myCrystalReportViewer.ReportSource = rpt
End Sub
This prints a wider page on-screen than without the code, so it is an improvement. Still, I would like to go
further, and the DissociatePageSizeAndPrinterPaperSize seems to be promising.
Can you tell me how to set it in the context above?
A little observation: When my newMargins.Right gets the value 145, the output is a narrow page.
When it is set to 146, it jumps to a wider page.
Setting the PageContentWidth doesn't help any more than the Right option.
- Kjell Arne
Hi Kjell Arne,
Now that you have upgraded to 2008 you need to install SP 1 which you can get from this link:
https://smpdl.sap-ag.de/~sapidp/012002523100010503722008E/cr2008_sp1.exe
The API will then be available.
Also, as a work around you can install a printer driver that supports large paper sizes and use one that has an option with a wide paper width.
Thank you
Don
You mention you do not use the "appserver". However, you should be able to use Don's code after doing the below (as long as you are using CR XI r2 or CR 2008):
1) Add these references to your project:
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.ReportSource
CrystalDecisions.Shared
CrystalDecisions.Windows.Forms
CrystalDecisions.ReportAppServer.ClientDoc
CrystalDecisions.ReportAppServer.Controllers
CrystalDecisions.ReportAppServer.DataDefModel
CrystalDecisions.ReportAppServer.ReportDefModel
2) Add these declaration to your code:
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
Dim rptClientDoc As ISCDReportClientDocument
3) Add this to your code under a button click:
rpt.load("C:\mytest\StdEnvelopeOut.rpt")
rptClientDoc = rpt.ReportClientDocument
4) From here on, adjust the code as per Don's post.
Other than that, I have no update on the TE.
Ludek
Hi Jeffsici and others,
We seem to have found a workaround that works for us anyway, at least for some of the reports.
If we open up the report in the designer tool and go to File, page setup,and here view the settings for the left margin-this is the settings hat is being ignored. If we instead drag the ruler on the document to the same amount(mm) it seems to be working.
Maybe this is not a solution for you but I thought I would share this just in case.
regards Uffe
Friends, Service Pack 3 is now available from
https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm
best regards
Uffe
ok, i found the Crystal Reports 2008 Service Pack 3 - Redist Install in the download area(the MSI in the ZIP is dated 22.4.2010 but the fix seems to be included:-)
But if a Redist SP2 is already installed on a machine, the SP3 cant be installed over that (Message: Another version of that product is already installed.Installation cant continue...). So you have to go to the windows control panel/Software and uninstall the SP2 by hand. Is there any way to avoid the manual deinstallation?
thanks
No there is not. It has been this way since SP 1. More info is available in [this|http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/702b3642-7e14-2c10-6484-857ffb4319d7?quicklink=index&overridelayout=true] article.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Ok, the problem with the margins is fixed as far as I can see. But a new little annoying thingey is now introduced, sadly. When you print a report, the default printer is not the selected option anymore, as was the case with previous versions. For people with a number of printers to select from and who print a lot of reports on a daily basis, this is extremely annoying. Depending on how the print dialog is shown, this is an extra clicking around in the new sp3. Sad...
it seems that the problem is not yet fixed complete. The SP3 is installed, the margins are looking better, but there are still differences between the margins in the report and the printout (about 3-6 mm). When exporting the report to PDF the margins are OK. I tried different reports. So what do to now?
I wonder if the way CR is expected to handle printing is an issue here. E.g.; in a nut shell;
If margins are still incorrect. Does printing work correctly from the designer? Ensure that exactly the same driver (and driver version) are used on the Crystal Reports machine and the App machine (not sure if these people are using windows or web apps). If no-printer is selected, this will cause the report to scale to fit the page when printing. Do not use u201Cno-printeru201D if margins must be exact.
The following resources may be worth looking at:
[How Printer Driver Options Affect a Report|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a09051e9-721e-2b10-11b6-f9c65c64ef29]
[Printing Web based reports with Crystal Reports for Visual Studio .NET|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/600c24a3-ab1d-2b10-1bb4-c50562e353cb]
The Crystal Reports designer (CRW32.exe) help file also contains info on CR and printing, both web and win environments.
Ludek
Edited by: Ludek Uher on Jul 27, 2010 2:58 PM
I*ve found (at least one) problem with the fact that default printer is not the selected option anymore.
Old code that we used in CR XI r2: crGeneratedReport.Open(CObj(m_ReportFilename))
We changed it to this when upgrading to CR2008 V1: crGeneratedReport.Open(CType(filePath, Object), CdReportClientDocumentOpenOptionsEnum.cdReportClientDocumentOpenAsReadOnly)
The problems with the printer started(and the margin problem as well, now solved thank god..)
We tweaked it a bit : crGeneratedReport.Open(CType(filePath, Object), 1)
Result: The default printer got selected the way it was supposed to...
Seems as not such a good idea to use the readonly option.
regards Uffe
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.