Página 1 de 2

Pagescript

Enviado: 22 Ago 2007 15:46
por Zeca Roque
Verificando os perfis dos membros deste forum notei que alguns usam PAGESCRIPT.
Estou com um problemaço e gostaria de saber se alguém já passou por isto:
Descobri que o PAGESCRIPT não dá suporte (EM WINDOWS XP) para formularios com
tamanho diferente da relação em que ele possue. Tenho um formulario com 5.5 x 8.5
polegadas(ou 140x210mm). Este formulario é do tipo meia pagina ou RAZÃO como chamam.
No Windows ME ele imprimia que era uma beleza. Só que compramos outro equipamento
e veio com o XP.
veja o que está escrito no site do fornecedor:

"
PSSetPageSize() with user defined dimensions is not supported on NT
based Windows versions, including Windows NT 3 and 4,
Windows 2000, Windows XP home and Pro and Windows server 2003.
With those versions, only predefined paper sizes are valid.

"

Como contornar esta situação(sem tacar fogo no computador é claro!!!)?.
Baixou o desespero em mim


Sds

Enviado: 22 Ago 2007 16:05
por Eolo
Qual versão do PS vc usa? Eu tenho a 4.20 e, nela, não achei essa restrição que vc apontou.

Enviado: 22 Ago 2007 16:20
por Zeca Roque
Eolo escreveu:Qual versão do PS vc usa? Eu tenho a 4.20 e, nela, não achei essa restrição que vc apontou.
Eu uso a versao numero 3.0.0.15. O problema encontrado é somente no formulario RAZÃO que é aquele com as medidas 5.5 x 8.5 Polegadas ou 140 x 210 milimetros. Acontece que estas medidas não estão discriminadas no CH do Pagescript. Eu uso o comando: PSSetPageSize(1400,2100). Tem como eu testar minha rotina com esta versão do pagescript ?

Enviado: 22 Ago 2007 16:27
por Eolo
A versão 4.20 tem (entre umas 4 dezenas de tamanhos pré-definidos) o DMPAPER_A5 (148 x 210 mm), além do "user defined paper size" (tamanho definido pelo usuário).

Complementando: o "razão" que vc citou tá lá: é o DMPAPER_STATEMENT (5.5 x 8").

Enviado: 22 Ago 2007 16:58
por Zeca Roque
Eolo escreveu:A versão 4.20 tem (entre umas 4 dezenas de tamanhos pré-definidos) o DMPAPER_A5 (148 x 210 mm), além do "user defined paper size" (tamanho definido pelo usuário).

Complementando: o "razão" que vc citou tá lá: é o DMPAPER_STATEMENT (5.5 x 8").
Boa tarde.

Estes dois tamanhos foram testados, sem sucesso. Voce não pode esquecer que a discriminação é ao contrario. por exemplo no caso do DMPAPER_A5(148X210mm) o 148 é a largura do papel e 210 é a altura.
O que preciso é exatemente ao contrario: 140 de altura e 215 de largura.
Estou dizendo isto porque já testei todos os valores que se aproximaram daquilo que preciso e nenhum funcionou. Testei tambem o comando
PSSetPageSize(1400,2150) que é o preciso, sem sucesso.
O tal "user defined" como se usa ?

Enviado: 22 Ago 2007 18:35
por Eolo
Zeca, estranho... Eu tenho o HELP original (da versão 4.0.6) e lá não há restrição ao uso do "user defined" sob o NT. Mas fui no HELP On-line (versão 4.2.0) e lá aparece a restrição! Acabei de pedir, por email, para eles esclarecerem isso. Vamos ver o que eles dizem.

O que diz no help do 4.0.6:
PSSetPageSize(<nLength|nPredefinedPageSize, [nWidth]>)

PSSetPageSize() lets you set the paper size of your document. It may be one of the predefined paper sizes as found in PScript.ini or a user defined size. To set a user defined size, you must provide a paper length and a paper width, expressed in 10th of millimeters. Predefined paper sizes are defined in PScript.ini and are based on Windows API constants. See Predefined paper sizes.

Enviado: 22 Ago 2007 18:44
por Zeca Roque
Eolo escreveu:Zeca, estranho... Eu tenho o HELP original (da versão 4.0.6) e lá não há restrição ao uso do "user defined" sob o NT. Mas fui no HELP On-line (versão 4.2.0) e lá aparece a restrição! Acabei de pedir, por email, para eles esclarecerem isso. Vamos ver o que eles dizem.

O que diz no help do 4.0.6:
PSSetPageSize(<nLength|nPredefinedPageSize, [nWidth]>)

PSSetPageSize() lets you set the paper size of your document. It may be one of the predefined paper sizes as found in PScript.ini or a user defined size. To set a user defined size, you must provide a paper length and a paper width, expressed in 10th of millimeters. Predefined paper sizes are defined in PScript.ini and are based on Windows API constants. See Predefined paper sizes.
Eis o que diz sobre as restrições:

PSSetPageSize() with user defined dimensions is not supported on NT based Windows versions, including Windows NT 3 and 4, Windows 2000, Windows XP home and Pro and Windows server 2003. With those versions, only predefined paper sizes are valid.

Enviado: 23 Ago 2007 08:06
por ederxc
PSSetPageSize(1400,2150) que é o preciso, sem sucesso.
O tal "user defined" como se usa ?

Bom dia , qual é a forma que voce esta usando para mandar os arquivo para impressora , modo FILE ou modo RAW ??


Pelo que andei vendo no Help o PS esta função pssetpagesize() esta para RAW que é usado os comando beginrawdoc e psendrawdoc

....................................................................
Opnião pessoal

Creio que ,para impressão em formularios com tamanhos ñ convencionais "A2/A4" , seria de melhor manuseio no modo RAW.
..........................................................................................................

Nos diga, como voce envia o documento para impressora.

See ya!

Enviado: 24 Ago 2007 11:20
por Eolo
Acabei de pedir, por email, para eles esclarecerem isso. Vamos ver o que eles dizem.
Zeca, recebi a seguinte resposta da PageScript sobre a tal limitação - "PSSetPageSize() with user defined dimensions is not supported on NT based Windows versions...":

"This limitation is true since the beginning of PageScript and is NOT related to PS itself. All Windows NT based OS are affected by this limitation due to the fact that in these versions, a user can create his own paper formats within the printer driver instead of by programmation. There's nothing we can do about that. Sorry."

Então, ou se usa um dos padrões ou se parte pro modo RAW...

Enviado: 24 Ago 2007 16:01
por Zeca Roque
Eolo escreveu:
Acabei de pedir, por email, para eles esclarecerem isso. Vamos ver o que eles dizem.
Zeca, recebi a seguinte resposta da PageScript sobre a tal limitação - "PSSetPageSize() with user defined dimensions is not supported on NT based Windows versions...":

"This limitation is true since the beginning of PageScript and is NOT related to PS itself. All Windows NT based OS are affected by this limitation due to the fact that in these versions, a user can create his own paper formats within the printer driver instead of by programmation. There's nothing we can do about that. Sorry."

Então, ou se usa um dos padrões ou se parte pro modo RAW...
Obrigado Eolo.

Vou debruçar sobre meus PRG´s, tentar mudar afim de eu possa usar o modo RAW. Primeiro tenho que saber exatamente como funciona o tal MODO RAW e se realmente ele vai me servir.

Obrigado + uma x :'(

Enviado: 24 Ago 2007 16:12
por Eolo
RAW quer dizer CRU e é "assim" que o PS trata a impressão nesse modo: manda qq coisa direto pra impressora, como se vc estivesse fazendo @X,Y SAY direto pra LPT1. Pelo RAW, por exemplo, vc pode mandar comandos ESC para uma impressora USB (desde que ela, lógico, não seja Windows Only).

Enviado: 24 Ago 2007 16:18
por Maligno
Pelo RAW, por exemplo, vc pode mandar comandos ESC para uma impressora USB (desde que ela, lógico, não seja Windows Only).
Mas Eolo, se você está enviando dados pro spooler, tanto faz qual o tipo da impressora. Por quê o spooler é quem se comunica com a impressora, não o seu programa.

Enviado: 24 Ago 2007 16:42
por Eolo
Vou fazer o seguinte: postar a seguir os 3 modos do PageScript, exatamente conforme está no help dele. Mais fácil de explicar...
Example 1 - WINDOWS mode

1 #Include "PScript.ch"
2 if PSInit() == 0
3 BEGINDOC USING PSGetDefPrinter() TITLE "Hello world"
4 PSSetUnit(APS_TEXT)
5 @5,5 TEXTOUT "Hello world"
6 ENDDOC
7 else
8 Alert("PageScript not responding or not installed")
9 endif
Lets explain the code, line by line.

Line 1 includes the PageScript include file containing the definitions for all the commands and constants used by PageScript.

Line 2 initialize the print engine, checks for the existance of the Windows printer driver (PScript.exe must be running) and returns 0 if everything is fine. You should call this function only once, at application start.

Line 3 asks PageScript to start a new document on the default printer with the title set to "Hello world"

Line 4 sets the unit of mesurement to text coordinates that barely mimics Clipper's rows and columns coordinate system.

Line 5 send the command to print "Hello world" at row 5 and column 5. It uses the default/current set font, font size, font foreground and background colors.

Line 6 asks PageScript to send the report to the proper Windows printer driver. Take note also that issuing an ENDDOC will automaticaly send a form eject. No need to force a page eject.

Line 7 is the standard Clipper else statement.

Line 8 Shows an alert box is the initialization of PageScript failed at line 2.

Line 9 is the end of the control structure.

Enviado: 24 Ago 2007 16:43
por Eolo
Example 2 - RAW mode

1 #Include "PScript.ch"
2 if PSInit() == 0
3 BEGINRAWDOC USING PSGetDefPrinter() TITLE "Hello world"
4 @5,5 say Chr(27) + "G" + "Hello world" + Chr(27) + "H"
5 EJECT
6 ENDRAWDOC
7 else
8 Alert("PageScript not responding or not installed")
9 endif
Lets explain the code, line by line.

Line 1 includes the PageScript include file containing the definitions for all the commands and constants used by PageScript.

Line 2 initialize the print engine, checks for the existance of the Windows printer driver (PScript.exe must be running) and returns 0 if everything is fine. You should call this function only once, at application start.

Line 3 asks PageScript to start a new RAW print job on the default printer port with the title set to "Hello world"

Line 4 Prints "Hello world" in bold, at row 5 and column 5, using IBM Graphics printer escape codes.

Line 5 sends the EJECT code ( Chr(12) ) to the printer port.

Line 6 asks PageScript to send the print job to the selected printer port.

Line 7 is the standard Clipper else statement.

Line 8 Shows an alert box is the initialization of PageScript failed at line 2.

Line 9 is the end of the control structure.

Enviado: 24 Ago 2007 16:44
por Eolo
Example 3 - EMULATION mode

1 #Include "PScript.ch"
2 if PSInit() == 0
3 SET DEVICE TO PRINT
4 SET PRINTER TO ("TEST.TXT")
5 @5,5 say Chr(27) + "B" + "Hello world" + Chr(27) + "b"
6 EJECT
7 SET PRINTER TO
8 SET DEVICE TO SCREEN
9 PSPrintFile("TEST.TXT", .t., 0, "Test", APS_PORTRAIT, 1)
10 else
11 Alert("PageScript not responding or not installed")
12 endif
Lets explain the code, line by line.

Line 1 includes the PageScript include file containing the definitions for all the commands and constants used by PageScript.

Line 2 initialize the print engine, checks for the existance of the Windows printer driver (PScript.exe must be running) and returns 0 if everything is fine. You should call this function only once, at application start.

Line 3 sets the device to the printer

Line 4 sets the printer to print in the TEST.TXT file.

Line 5 prints "Hello world" in bold, at row 5 and column 5, using PageScript's universal printer escape codes.

Line 6 sends the EJECT code ( Chr(12) ).

Line 7 close the file.

Line 8 sets the device to screen

Line 9 asks PageScript to parse and translate the file (TEST.TXT) to corresponding GDI commands so that it is compatible with all Windows print devices.

Line 10 is the standard Clipper else statement.

Line 11 Shows an alert box is the initialization of PageScript failed at line 2.

Line 12 is the end of the control structure.