VB Crystal Report >> custom paper size using CR 7 (Help please!!)

by SnVuaW9y » Fri, 20 May 2005 10:44:03 GMT

I have a code for customize paper size with CR 7 and VB 6.0, but each time i
send the report to the printer i see a dialog box counting pages and never
prints.
Any idea?

I took the example from
http://support.businessobjects.com/library/kbase/articles/c2005467.asp

******************* Declations code ******************
Type crDEVMODE
dmDriverVersion As Integer
' printer driver version number (usually not required)
#If Win16 Then
' add padding so it aligns the same way under both 16-and 32-bit
environments
pad1 As Integer
#End If
dmFields As Long
'flags indicating fields to modify (required)
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
End Type

Declare Function PEOpenEngine Lib "crpe32.dll" () As Integer
Declare Function PEOpenPrintJob Lib "crpe32.dll" (ByVal RptName$) As Integer
Declare Function PEOutputToPrinter Lib "crpe32.dll" (ByVal printJob%, ByVal
nCopies%) As Integer
Declare Function PEStartPrintJob Lib "crpe32.dll" (ByVal printJob%, ByVal
WaitOrNot%) As Integer
Declare Function PEClosePrintJob Lib "crpe32.dll" (ByVal printJob%) As Integer
Declare Sub PECloseEngine Lib "crpe32.dll" ()
Declare Function crPESelectPrinter Lib "crwrap32.dll" (ByVal printJob As
Integer, ByVal driverName As String, ByVal printerName As String, ByVal
portName As String, crmode As crDEVMODE) As Integer

' ********************** Code from the form *********************
Dim Job As Integer
Dim Result As Integer
Dim MyDevMode As crDEVMODE
' Open print engine
Result = PEOpenEngine()
' Open the selected report
Job = PEOpenPrintJob(App.Path & "\Cheque1.rpt")

MyDevMode.dmFields = DM_PAPERSIZE + DM_PAPERLENGTH + DM_PAPERWIDTH
MyDevMode.dmPaperSize = DMPAPER_USER ' or 256
MyDevMode.dmPaperLength = 254
MyDevMode.dmPaperWidth = 1004
' paper length and width in tenths of a mm (1 inch long, by 4 inches wide,
above)

Result = crPESelectPrinter(Job, driverName & vbNullChar, printerName &
vbNullChar, portName & vbNullChar, MyDevMode)

' **************************************************


'Specify the destination as printer
Result = PEOutputToPrinter(Job, 0)
'Start the print job
Result = PEStartPrintJob(Job, 0)
'Close the print job
PEClosePrintJob (Job)
'Close the engine
PECloseEngine


Similar Threads

1. Custom paper size in CR - VB Crystal Report

2. Cannot print using custom paper size (Crystal Report .NET)

3. Printing on a Custom Paper Size - VB.Net

4. Custom Paper Sizes

Hello all,

not sure if this has been posted before but all similar posts never seem to
get anywhere.

I need to programmatically (vb.net) create a custom paper size for a
specified printer then set the printers default paper sizes to this custom
size.

This is the same as going into printers > file > server properties and
creating a new form then cycling through the printer properties and setting
all feeders and defaults to the new size but this is a bit long winded for
my users and prone to many fat-finger-errors.

I know this can be done through the win32 api using addform,setform etc. but
have never seen anything about using it from vb.net.

Has anyone ever done this or can anyone point me in the right direction ?

Thankx in advance

Keith


5. Getting the paper size for a custom printer form - VB.Net

6. Custom size paper problem

Hi,
I am tring to change the paper size from default to custom paper size.
In print preview its showing my custom size but when I print it print
on default paper size.
Can any one help me to figure out this?
I am using following code:
 Dim customPaperSize As New PaperSize("11x9", 1100, 900)

pdMain.DefaultPageSettings.PaperSize = customPaperSize

'pdmain is  Friend WithEvents pdMain As
System.Drawing.Printing.PrintDocument

Thanks in advance
Sukh

7. Printing With Custom Paper Size - VB.Net

8. Adding Custom Paper Size in Crystal Reports

Respected Sir / Madam,
 I am working as  a softwareprofessional with core MicroSoft Technologies. 
At present I am working in .Net 2003. I am using the Crystal Reports that 
comes along with the .Net 2003 package for my Reporting Purpose. I have a 
problem in printing the reports when it comes to printing it in a Custom 
Paper size. The paper size that i use is  10in x 12in. I have set the paper 
size in the printer using the server properties in the Control panel. I am 
not able to set the paper size in the coding part as we usually do using the 
REport.Printoptions.Papersize.

It shows only the Names of the paper that it supports. how to i Set the 
paper size to 10in x 12in.  Everytime otherwise i have to go to the Advanced 
properties in the print dialog box ,that pops up when we click the print 
button in the viewer, set the paper size which is defaulted to Letter and 
then print it. 

I would be really GRATEFUL if any of u can help me out in this problem.

Thanks

Waiting for a positive reply

Please i need  Clear solution. pleaseeeeeeeeee



-- 
Think Positive. There is always an answer for a Problem. Never Say Die.