Solved

Problem with setting PaperSize

Posted on 2007-03-23
10
1,691 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 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
Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

 

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
 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
sort by a cross tab in crystal report 2 59
Speed Up Crystal Report 5 66
Help with a Crystal Report Formula 8 53
Pagination Difference  in crystal report 7 59
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. …
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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