?
Solved

Problem with setting PaperSize

Posted on 2007-03-23
10
Medium Priority
?
1,747 Views
Last Modified: 2012-06-21
Crystal XI, VB6

I'm trying to set the PaperSize property of a report, but getting "Invalid procedure call or argument".

The printer I have is returning (via DeviceCapabilities) paper types of 542 and 557, but the PaperSize parameter seems to have a range of 0 to 256, anything outside this generates the above error.

Anyone else come across this and know of a solution?
0
Comment
Question by:StuckInTheMud
  • 4
  • 4
  • 2
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 18782981
What are you trying to accomplsh with this?

mlmcc
0
 

Author Comment

by:StuckInTheMud
ID: 18783064
The output device is an ID card printer and I need to be able to specify via the application which type of card has been inserted.

Although I have specified the default in the print setup of the report at design time, this can change when the print is actually performed. Using the print dialogue is not an option as it is being used by very non-PC literate people.



Jim
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 18783737
The easiest solution to implement might be to have one report for each card type and print the one for the card selected.

Do all cards have the same format and data size?  The only thing that you control is the margins?

Was the report built with this printer as the default?

mlmcc
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:StuckInTheMud
ID: 18784648
One of the other problems I've had is the report not obeying the exact settings that have been configured at design time. Printer type seems OK but other settings (such as resolution) have a mind of their own, hence the the need to tell the report exactly what it is doing!

Still doesn't answer the original question of whether there is a way of forcing the correct size into PaperSize.

A thought has just occurred to me that perhaps these values exist in a more generic parameters collection somewhere, which does not have the same value limitations.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 18785118
What code are you using to set the paper size?

mlmcc
0
 

Author Comment

by:StuckInTheMud
ID: 18785202
varPrinter, varBin and varPaper have been set through a setup selection process using DeviceCapabilities. First is a string, the other two int.

        Set crxRpt = crxApp.OpenReport(varReportFileName)

        'Find specified details so driver and port can be set correctly
        For Each prt In Printers
            If prt.DeviceName = varPrinter Then
                Set Printer = prt
                strDriverName = prt.DriverName
                strDeviceName = prt.DeviceName
                strPort = prt.Port
               
                crxRpt.SelectPrinter strDriverName, strDeviceName, strPort
                Exit For
            End If
        Next
       
        crxRpt.PaperSource = varBin
        crxRpt.PaperSize = varPaper
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 18785278
YOur code looks similar to what I have used in the past.
http://www.experts-exchange.com/Database/Reporting_/Crystal_Reports/Q_20762547.html

mlmcc
0
 
LVL 4

Accepted Solution

by:
stcindia earned 750 total points
ID: 18787519
Pasted from Official Website

This is a known issue with the Report Designer Component. This issue has been assigned Track ID ADAPT00069359.
As of the publish date of this article, there are no file updates to correct this issue for version 8.5 of Crystal Reports.
To work around this issue, use the 'PrinterSetup' method to prompt for a printer and paper size.
In the RDC version 9 and higher, there is a new ‘SetUserPaperSize’ property that you can use to set the width and height of a custom paper size. Use it in conjunction with the ‘PaperSize’ property. For example:
Report.PaperSize = crPaperUser
Report.SetUserPaperSize 8, 5
====================
NOTE:
By default the RDC 'PaperSize' property is restricted to numeric values of 255 or smaller.
====================

I am using crystal report 8.5 so I am unable to test this example, I think your can ignore .PAPERSIZE and use .SETUSERPAPERSIZE
0
 

Author Comment

by:StuckInTheMud
ID: 18791682
What amazes me here is that the problem seems to have existed in v8, but we are now on v11.5 and its still there!

OK, looks like I'm going to have to go down the route of using SETUSERPAPERSIZE and store sizes + margins. Not ideal but there you go.

Thanks for the input.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question