Solved

Problem with setting PaperSize

Posted on 2007-03-23
10
1,659 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

862 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

25 Experts available now in Live!

Get 1:1 Help Now