Crystal report in CTD1.5 Change Printer

forum.3rdparty.tools (2005-2010)
Walter Moser

Crystal report in CTD1.5 Change Printer

Post by Walter Moser » 17 Sep 2007, 16:35

 Posted by:  Walter Moser 

Hi there!

From a PreviewWindow (CRPE.APL) i click the Print-Button.
Now i want to change the Printer end its orientation (MUST do this!).
I believe, if i use WinApi's PrtDlgA (or something like this) the User can
Set another Printer and change its orientation.
But after coming back to my Code, it looses the changes.

How can i change the Orientation of the Standard-Printer wich is selected?
I think i have to use the DEVMODE Structure from the WinApi, but i have no
Idea how to build it in Centura.

Does anyone know how to do?

Thanks

Walter

cschubert
Germany
Posts: 867
Joined: 23 May 2018, 11:26
Location: Germany

Re: Crystal report in CTD1.5 Change Printer

Post by cschubert » 18 Sep 2007, 12:48

 Posted by:  Christian Schubert 

Walter,

yes using the DEVMODE struct is correct. Define this parameter in the
external function as String/LPVOID and use the CStruct* functions to set the
struct members.

HTH

Christian Schubert

Walter Moser

Re: Crystal report in CTD1.5 Change Printer

Post by Walter Moser » 18 Sep 2007, 13:07

 Posted by:  Walter Moser 

Hi Christian!

Thank you so far....
Ok, what exactly can i do?
- I want the user change the Printer, wich is now the Standard.
- I want to look in the Report, wich Orientation is defined in it.
- I want to tell the Standard-Printer, to change its orientation to the
defined
-- Just print out the Report

Like this:
Set nBufferLength = 156
Call SalStrSetBufferLength(sDevModeIn, nBufferLength)
! Look for the defined Properties:
Call PEGetSelectedPrinter( niJobNo, sDriver, N1, sDevice, N2, sPort, N3,
sDevModeIn )
! Change the Standard:
Call SalPrtGetDefault( sDevice, sDriver, sPort )
Call DocumentPropertiesA( hWndForm, hPrinter, sDevice, sDevModeOut,
sDevModeIn, nFlags )
! Tell the Report to use this (maybe without the previous line?
Call PESelectPrinter( niJobNo, sDriver, sDevice, sPort, sDevModeOut )

Is this the right way?

Tanks forward
Walter

Walter Moser

Re: Crystal report in CTD1.5 Change Printer

Post by Walter Moser » 20 Sep 2007, 15:15

 Posted by:  Walter Moser 

Hi Christian!

Thank you so far....
Ok, what exactly can i do?
- I want the user change the Printer, wich is now the Standard.
- I want to look in the Report, wich Orientation is defined in it.
- I want to tell the Standard-Printer, to change its orientation to the
defined
-- Just print out the Report

Like this:
Set nBufferLength = 156
Call SalStrSetBufferLength(sDevModeIn, nBufferLength)
! Look for the defined Properties:
Call PEGetSelectedPrinter( niJobNo, sDriver, N1, sDevice, N2, sPort, N3,
sDevModeIn )
! Change the Standard:
Call SalPrtGetDefault( sDevice, sDriver, sPort )
Call DocumentPropertiesA( hWndForm, hPrinter, sDevice, sDevModeOut,
sDevModeIn, nFlags )
! Tell the Report to use this (maybe without the previous line?
Call PESelectPrinter( niJobNo, sDriver, sDevice, sPort, sDevModeOut )

Is this the right way?
But it doesn't work!

Tanks forward
Walter

cschubert
Germany
Posts: 867
Joined: 23 May 2018, 11:26
Location: Germany

Re: Crystal report in CTD1.5 Change Printer

Post by cschubert » 20 Sep 2007, 20:10

 Posted by:  Christian Schubert 

Walter,

I would assume that it is not necessary to change the orientation before
printing. CR should do this automatically. Are you sure this is necessary?
Anyway, you are probably missung

OpenPrinter ( sDevice, hPrinter, STRING_Null )

prior to calling DocumentPropertiesA and something like

nFlags = DM_IN_BUFFER

HTH

Christian

Walter Moser

Re: Crystal report in CTD1.5 Change Printer

Post by Walter Moser » 21 Sep 2007, 11:14

 Posted by:  Walter Moser 

Thanks Christian,

sorry, yes i'm sure, i need to change the orientation if the printer is an
other then the one defined in the report.
If i don't change the orientation, it comes out in the orientation wich is
defined in the printer at this time.

I forgot to say that i called OpenPrinter before i use DocumentPropertiesA
...

A fine way would be, to ask the user!
I tried to call DocumentPropertiesA with Flag DM_PROMPT. So the Dialog asks
me about the configuration. But i have no chance to change the device this
way.

What i want is just to ask for a different Printer and use the same
orientation as defined in the report.
I'm very unhappy, do you have some more ideas?

Greetings from Landau
Walter

Return to “3rdparty.tools”

Who is online

Users browsing this forum: [Ccbot] and 0 guests