?
Solved

Problem with setting PaperSize

Posted on 2007-03-23
10
Medium Priority
?
1,722 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

770 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