Solved

Problem with setting PaperSize

Posted on 2007-03-23
10
1,643 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 100

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 100

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
 

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 4

Expert Comment

by:stcindia
ID: 18784663
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 100

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 100

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 250 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 run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now