cancel
Showing results for 
Search instead for 
Did you mean: 

Printer settings do not works on CR XI ActiveX

Former Member
0 Kudos

My application written in VB6 print a lot of reports using the CrystalReportActiveX directly to different printers, according to the setting of the client that is printing. I mean: print 1 copy on printer A, using bin 2, print 2 copies on printer B, using bin 1, etc..

With Cristal Reports 8.5 everything was well.

Now I am using Cristal Report XI R2 with all Service Packs but it does not work well.

I can reach the different printers, but the setting on the client are not respected. It means that I cannot print using the paper size or the paperbin I want. The printout is 'random'.

For exemple I use 3 Tally 9025 printers in different offices. I have the same settings on the client driver and the printers have the same settings on their built-in control panel.

But on the first printer the printout is on paperbin 1, on the second only the first page is on paperbin 1 and the following pages on paperbin 2, and so on.

If i do not print directly, but I use the CRXreport.PrintOut True the output is correct.

That is the code I use and it works fine in CR 8.5

Set CRXreport = crxApplication.OpenReport(pathreports & "Bozza multipla.rpt")

CRXreport.ReportTitle = "Bozza per " & nomesocieta

CRXreport.DiscardSavedData

'sel_devicename : parameters from Printers()

'sel_drivername

'sel_port

CRXreport.SelectPrinter sel_drivername, sel_devicename, sel_port

CRXreport.RecordSelectionFormula = strRECORDSOURCE

CRXreport.ReadRecords

CRXreport.PrintOut False, n_copie

Why does not it work in CR XI?

Anyone can help me?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello, Paolo;

There were some changes to printing with Crystal Reports 9.0 and later.

CRXreport.SelectPrinter sel_drivername, sel_devicename, sel_port

'PaperOrientation is required when setting SelectPrinter
CRXreport.PaperOrientation = crDefaultPaperOrientation

There is also an issue with the application looking for the exact printer saved in the report before recognising what is in code.

Test with a report that you have set the properties in the Crystal Reports designer (e.g. Orientation and Paper size) but have the Printer set to "No Printer".

Does that resolve the issue?

Search for craxdrt.dll on the application system. Go to properties and the Version tab. What is the full version? (11.5.x.xxxx).

Elaine

Former Member
0 Kudos

I am sorry to be so late for my answer.

I tried to use reports with No printer settings in report, I added PaperOrientation in the application but nothing changed.

The craxdrt.dll versioni is 11.5.11.1470

Yours

Former Member
0 Kudos

Hello, Paolo;

Are the printers network printers?

Are the printers installed as network printers on the local machine so that the required printer drivers are local?

Are the printer drivers for Tally 9025 unicode compliant? (Required in version 9.0 and later)

Does the application print correctly using another type of printer?

If the settings and code are not being used, the usual cause is the printer drivers loading are not capable of the properties set.

An example would be a label printer with a page size of 4 X 5 needs to load the appropriate Zebra drivers. Instead the application does not have access to those drivers on the local machine so it loads the default Windows driver. The label formats incorrectly as an 8.5 X 11 page.

You can use our Modules utility on a working system and on a nonworking system to compare the printer drivers loading in each case.

Run our Modules utility on the working system when the report is in the preview window. Save the resulting file as working.mdl.

Do the same on the non-working system. Save that as nonWorking.mdl.

You can find the utility at:

https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip

NOTE: The above links may be spread across two lines. Be sure you paste the entire link otherwise you may get the "HTTP: 404 Page Not Found" error.

I usually minimize it in the task bar until the application is running the report and then open it and choose File|New .... Modules in Memory.

Compare the resulting files as described in "modules_how_to_use.pdf". What printer drivers do you see?

I will be watching for your reply.

Elaine

Former Member
0 Kudos

All the printers are network printers, they are all installed on local machine and the drivers are local.

The problem happens onTally 9025 and on all other printer on the network (HP4050TN - HP2100TN - Xerox 7700 - Datamax I4208 - Minolta PagePro)

With the same application, drivers and settings but using craxdrt.dll 8.5 everything works well, but I cannot go back to Crystal 8.5 with all my applications.

I will trie to use your Modules utility whit Crystal XI and I will downgrade the same report to Crystal 8.5 and I will send you the results.

Yours

Former Member
0 Kudos

How can I send you the to files *.mdl for comparison?

There are many differences between the two modules and I cannot understand them.

Thanks

Former Member
0 Kudos

I noted another problem related.

Some reports must be printed with a logo if they must be posted to people outside the company.

To do this the bitmap is printed if the CRXReport.ReportTitle property is set to "LOGO" and I do this in the application.

With CR 8.5 it works, with CR XI.5 it does not work.

If I print on the report the ReportTitle it appears to be the ReportTitle set when I designed the report and it does not change setting it in the application.

New ideas?

The problem is becoming serious because we must print all the reports on a printer, changing paper every time.

Thanks

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello, Paolo;

There are many changes from Crystal Reports 8.5 to Crystal Reports XI R2 (11.5). The program was completely rewritten in version 9.0.

I would like to eliminate as much complexity as possible.

Please create a simple Visual Basic application referencing only two files for the Crystal Reports portion:

Crystal ActiveX Report Viewer Library 11.5

Crystal Reports ActiveX Designer Runtime Library 11.5

Put the viewer on a form so we can see the ReportTitle field without printing:

Dim crxApplication As New CRAXDRT.Application
Dim External_Report As CRAXDRT.Report
Dim ReportFileName As String

Private Sub Form_Load()
Screen.MousePointer = vbHourglass


'Reference external report through Object model
CommonDialog1.InitDir = App.Path
CommonDialog1.Filter = "RPT Files (*.rpt)|*.rpt"
CommonDialog1.ShowOpen

ReportFileName = CommonDialog1.FileName

Set External_Report = crxApplication.OpenReport(ReportFileName)

External_Report.ReportTitle = "This is a test"

CRViewer115.ReportSource = External_Report
CRViewer115.ViewReport

Screen.MousePointer = vbDefault

End Sub

Create a new report in the Crystal Reports XI R2 designer.

u2022 Do not add a database connection.

u2022 Leave the report blank except for the Report Title field in the report header.

u2022 Run the simple code above.

Do you see the title "This is a test"?

I tested it here with your version of service packs and it runs as expected.

On a separate issue, you can not use Visual Basic 6.0 to create an installation package for Crystal Reports XI R2.

There is a document to describe Deployment in the newer versions with Merge Modules [here|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/901c0761-cf1d-2b10-dea4-8e83937a9337].

For creating a deployment package, the Windows Installer in Visual Studio 6.0 is too old to handle customizable merge modules.

[Click|https://bcp.wdf.sap.corp/sap(bD1lbiZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=690076005F006D006F00640065003D003000300031002600690076005F007300610070006E006F007400650073005F006E0075006D006200650072003D0030003000300031003200310038003400320030002600]

You can use Windows Installer 1.1 from Microsoft.

[Click|http://msdn.microsoft.com/en-us/vs2005/aa718352.aspx]

To get the keycode into the merge modules for deployment you would need to use ORCA with Windows Installer 1.1.

[Click|https://bcp.wdf.sap.corp/sap(bD1lbiZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=690076005F006D006F00640065003D003000300031002600690076005F007300610070006E006F007400650073005F006E0075006D006200650072003D0030003000300031003200310038003600320032002600]

Here is an older article describing creating a package with Wise. It is still similar:

[Click|https://bcp.wdf.sap.corp/sap(bD1lbiZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=690076005F006D006F00640065003D003000300031002600690076005F007300610070006E006F007400650073005F006E0075006D006200650072003D0030003000300031003200310038003600320032002600]

There is another one describing Installshield:

[Click|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/708a8d1e-ca1d-2b10-2491-dd436543069b]

Here are the merge modules for Crystal Reports XI R2. SP5 is not available yet - the latest are SP4.4 are [here|https://smpdl.sap-ag.de/~sapidp/012002523100011452002008E/crxir2fp44_rdc_mm.zip]. The associated .pdf can be found [here|http://resources.businessobjects.com/support/communityCS/TechnicalPapers/rdcXI_deployment.pdf].

Let me know if you have any questions.

Elaine

Technical Customer Assurance Team

Business Objects an SAP company

www.businessobjects.com

0 Kudos

Hi Paulo,

I noticed there are differences in the usp10.dll. Copy the one from the the CR 8.5 location into the CR XI R2 C:\Program Files\Business Objects\Common\3.5\bin folder so CR can use the correct one. We have a specific dependency on that version of the dll.

CR 8.5

usp10.dll Version 1.0420.2600.5512 (xpsp.080413-2105) - copy this one to our \bin folder

craxdrt.dll Version 8.5.0.674

craxddrt.dll (not used)

crviewer.dll Version 8.6.1.758

crqe.dll Version (not used)

CR XI rev.2

usp10.dll Version 1.0405.2416.1 (lab06_N.010104-1344)

Thank you

Don

ido_millet
Active Contributor
0 Kudos

Hi Paulo,

Perhaps this is a match to the following issue, which is listed as resolved in SP5:

-


ADAPT01104291

Description:

Crystal reports may not print properly after users change printers by using the SelectPrinter command from the Report

Designer Component (RDC) .

The cause of the problem is that the incorrect DEVMODE structure size is allocated to the print job.

New Behavior:

This problem is resolved.

-


Former Member
0 Kudos

Sorry to be late for answer.

I tried your test and it works.

But also in my application when I define ReportTitle the first time it works.

I use this code:

CRXreport.ReportTitle ="AAAA"

CRXreport.SelectPrinter sel_drivername, sel_devicename, sel_port

CRXreport.PrintOut False ,1

I get the correct ReportTitle printout (but with random use of printer settings)

Then the application goes on

CRXreport.ReportTitle ="BBBB"

CRXreport.SelectPrinter sel_drivername2, sel_devicename2, sel_port2

CRXreport.PrintOut False ,1

I get a wrong ReportTitle printout (the ReportTitle is always "AAAA") and printer setting for 'sel_printer2' are random.

I added only this code to your test to test printout

Private Sub Form_Load()

If Printers.Count = 0 Then

MsgBox "No printer."

End

Else

' seleziona la stampante

For i = 0 To Printers.Count - 1

cboPrinter.AddItem Printers(i).DeviceName

If Printers(i).DeviceName = DefaultPrinter Then

stampantepref = i

DefaultPrinter = Printers(i).DeviceName

End If

Next

cboPrinter.ListIndex = stampantepref

End If

end sub

Private Sub Command1_Click()

stampantepref = cboPrinter.ListIndex

DefaultPrinter = Printers(cboPrinter.ListIndex).DeviceName

sel_devicename = Printers(cboPrinter.ListIndex).DeviceName

sel_drivername = Printers(cboPrinter.ListIndex).DriverName

sel_port = Printers(cboPrinter.ListIndex).Port

n_copie = 1

External_Report.SelectPrinter sel_drivername, sel_devicename, sel_port

External_Report.PrintOut False, n_copie

External_Report.ReportTitle ="AAAA"

External_Report.PrintOut False, n_copie

End Sub

ReportTitle is always "This is a test"

Nothing else in the report, no database, no picture. Only ReportTitle

I greaty appreciated your information about Deployment and I will use these information in the future.

But my problem is still here.

Thank you very much

Former Member
0 Kudos

I have SP5 installed but the problem is not solved

0 Kudos

Hi Paolo,

Cool we are getting somewhere now.

The problem is you need to report.DiscardSavedData and re-run the report so the new report title will be used.

If that doesn't fix the issue then please create a new post, this one is for printing only and not refreshing the data. Just to keep these clear on each question.

Thank you

Don

Former Member
0 Kudos

Hi Don

I know that if I use DiscardSavedData and re-run the report this problem is solved, but it was not necessery to do this in CR 8.5. To read records again takes about 10/15 seconds and I have to do this from 6 to 8 times for every printout to get 6/8 different prints.

But the real great problem is the random use use of printers setting.

Thank you

0 Kudos

Hi Paolo,

Try this type of code:

crPO = crReport.PaperOrientation

crPSS = crReport.PaperSize

crPSS = 262 ' custom paper enum.

crPSR = crReport.PaperSource

crReport.SelectPrinter "pscript5.dll", "
vanprt04\P6-4050TN-TS1", "10.50.48.22"

'crReport.SelectPrinter "pscript5.dll", "HP LaserJet 8150 Series PS", "LPT1"

'crReport.SelectPrinter "zsdzpl.dll", "Zebra Z4M Plus (200dpi)", "LPT1"

crReport.PaperOrientation = crPO

crReport.PaperSize = crPSS

crReport.PaperSource = crPSR

crReport.PrinterDuplex = crPRDPDefault

Not sure why you are getting random printer options.

Thank you

Don

Former Member
0 Kudos

Hello, Paolo;

Check the title field on the report. Is it a Text field or is it inserted onto the report from the Field Explorer|Special Fields| Report Title? I tested with that field and the following code succeeds.

CRXreport.ReportTitle = "This is a Report Title Field"

Is the information in the ReportTitle being used to change what is happening in the report or only to describe what you have designed. E.g. using the title "LOGO-XXXXXRED-Paolo Medina" are you suppressing or unsupressing the Logo field and changing the font colour in the title from some other colour to Red?

I am trying to determine if the title and printing issues are related or separate?

When you looked at Modules on the two systems, what are the printer divers you see loading?

What is the version of the following files on each system:

usp10.dll

craxdrt.dll

craxddrt.dll

crviewer.dll

crqe.dll

How were the files installed on the client system? How did you create the installation package?

Elaine

Former Member
0 Kudos

Here is dll versions:

CR 8.5

usp10.dll Version 1.0420.2600.5512 (xpsp.080413-2105)

craxdrt.dll Version 8.5.0.674

craxddrt.dll (not used)

crviewer.dll Version 8.6.1.758

crqe.dll Version (not used)

CR XI rev.2

usp10.dll Version 1.0405.2416.1 (lab06_N.010104-1344)

craxdrt.dll Version 11.5.11.1470

craxddrt.dll (not used)

crviewer.dll Version 11.5.11.1470

crqe.dll Version 11.5.11.1470

The Report Title is the value I have in Menu- File - Informazioni di riepilogo (Tab) Riepilogo (Field) Titolo

(CR XI in italian) I can change it at design time and if I change it the report reacts exactly as I aspect but I cannot change it at runtime within the application. Of course I use ReportTitle to change the aspect of the report according to the use of the report.

I think that the problems of Report Title and printer settings are related because they appeared with migration to CR XI.

The problem happens also on the machine I use to design reports and on this PC I only installed CR XI and ServicePacks and was not necessery to create an installation package for Crystal Reports.

For the other clients I prepared an installation package from VB 6 and the dll's are in the same directories' structure of the machine where CR XI is installed for report design.

Thanks for your patience.

Former Member
0 Kudos

Sorry

The printer driver is Winspool.drv Version 5.1.2600.5512 (xpsp.080413-0852)

Former Member
0 Kudos

Hello, Paolo;

There is no option for in depth one on one support in the forums and you cannot attach or send the Modules snapshot to me.

You can search through details of the Modules snapshot and find the printer drivers loading in each case. They will be described in the column on the far right. Then you can tell me what they are or you may want to open a support case to go over it in more detail to a resolution.

For your second question, There is new functionality for OLE Objects.

1. Open the report in the Crystal Reports Designer.

2. Create a formula called "Location" that contains a temporary path string to an image file. For example, "C:\Images\Image1.jpg".

3. Right-click on the image you have placaed on the report and click 'Format Graphic'. The 'Format Editor' dialog box appears.

4. In the 'Picture' tab, click the 'Graphic Location' conditional formula button. The Format Formula Editor appears.

5. Call the {@Location} formula from this conditional formula field.

6. Save changes to the report.

7. In your application, you can now change the location of the image file at run time, by modifying the text in the "Location" formula programmatically using the following code:

Dim crxformulafield As CRAXDRT.FormulaFieldDefinition

If crxformulafield.Name = "{@Location}" Then
   'set the formula text 
   crxformulafield.Text = "C:\Temp\Logo.jpg"
End If

You can now view the image successfully when previewing your report in the application.

Is that what you are looking for?

Elaine

Former Member
0 Kudos

No. The problem is not related to Ole Objects.

The bitmap I must print is fixed and is contained in the report.

I use the .ReportTitle property to pass to the report a string that modifies the printing of the report according to some parameter contained in the string.

For exemple the string (ReportTitle) should be: "LOGO-XXXXXRED-Paolo Medina"

in this case the logo contained in the report is printed, the font color of the title is RED and the person that has created the report is Paolo Medina.

But with CR XI this has stopped working.

The .ReportTitle is always the string written when the report was designed.

And in the same way are not recognized printer settings.

I have searched through details of the Modules snapshot and found the same printer driver loaded.

Yours