win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Moderador: Moderadores
-
lapinhazzz
- Usuário Nível 3

- Mensagens: 130
- Registrado em: 20 Abr 2009 10:52
- Localização: LAGOA
win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Boa Noite amigos do Forum.
Estou tentando em imprimir uma imagem com a classe win32prn() com o pdfcreator 1.2.0 e mostrar no adobe 9.3.0 mas não estou conseguindo.
Tenho o pdfcreator mais recente e o adobe acrobat reader 9.3.0.
Como faço para imprimir com estes dois programas.
Alguém tem alguma sugestão?
Sei que só pode ser com um determinado pdfcreator e um acrobat especifico.
Se algum amigo do forum tiver um exemplo (prg) para imprimir com a classe win32prn() que mencionei atrás ficaria muito grato.
Saudações a todos
lapinhazzz
Estou tentando em imprimir uma imagem com a classe win32prn() com o pdfcreator 1.2.0 e mostrar no adobe 9.3.0 mas não estou conseguindo.
Tenho o pdfcreator mais recente e o adobe acrobat reader 9.3.0.
Como faço para imprimir com estes dois programas.
Alguém tem alguma sugestão?
Sei que só pode ser com um determinado pdfcreator e um acrobat especifico.
Se algum amigo do forum tiver um exemplo (prg) para imprimir com a classe win32prn() que mencionei atrás ficaria muito grato.
Saudações a todos
lapinhazzz
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
lapinhazzz
Ai vai:
/*
* Harbour Project source code
* Demonstration code for generating .pdf documents using PDFCreator
* COM interface.
*
* You should install PDFCreator to be able to run this test
*
* Download site:
* http://sourceforge.net/projects/pdfcreator/
*
* COM interface docs:
* http://www.pdfforge.org/content/com-interface
*
* Copyright 2010 Mindaugas Kavaliauskas <dbtopas / at / dbtopas.lt>
* www - http://harbour-project.org
*
*/
O teste você encontra na pasta \contrib\hbwin\tests\pdfcreat.prg
Você deve baixar a última atualização do harbour, porque houve correções.
Ai vai:
/*
* Harbour Project source code
* Demonstration code for generating .pdf documents using PDFCreator
* COM interface.
*
* You should install PDFCreator to be able to run this test
*
* Download site:
* http://sourceforge.net/projects/pdfcreator/
*
* COM interface docs:
* http://www.pdfforge.org/content/com-interface
*
* Copyright 2010 Mindaugas Kavaliauskas <dbtopas / at / dbtopas.lt>
* www - http://harbour-project.org
*
*/
O teste você encontra na pasta \contrib\hbwin\tests\pdfcreat.prg
Você deve baixar a última atualização do harbour, porque houve correções.
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
- sygecom
- Administrador

- Mensagens: 7131
- Registrado em: 21 Jul 2006 10:12
- Localização: Alvorada-RS
- Contato:
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Se for com xHarbour, de uma olhada no link abaixo:
viewtopic.php?t=5764
viewtopic.php?t=5764
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
xHarbour.org + Hwgui + PostgreSql
-
lapinhazzz
- Usuário Nível 3

- Mensagens: 130
- Registrado em: 20 Abr 2009 10:52
- Localização: LAGOA
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Boa Tarde Asimoes e sygecom e a todos do forum.
Já baixei a mais recente versão do xharbour 2.0.0. Tem um problema. Não sei qual é o compilador, quais as configurações que se fazem de ambiente para este xharbour recente. Encontrei o link do contrib com o teste só que não estou conseguindo compilar com a versão mais recente do xharbour 2.0.0.
Por favor se puderem ajudar agradeço.
Obrigado
Lapinhazzz
Já baixei a mais recente versão do xharbour 2.0.0. Tem um problema. Não sei qual é o compilador, quais as configurações que se fazem de ambiente para este xharbour recente. Encontrei o link do contrib com o teste só que não estou conseguindo compilar com a versão mais recente do xharbour 2.0.0.
Por favor se puderem ajudar agradeço.
Obrigado
Lapinhazzz
- sygecom
- Administrador

- Mensagens: 7131
- Registrado em: 21 Jul 2006 10:12
- Localização: Alvorada-RS
- Contato:
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Olá Lapinhazzz,
Que nem diria o Jack, vamos por parte. Você falou em xHarbour 2.0.0 o xHarbour tem apenas até a versão 1.2.1 esse 2.0.0 é o Harbour.
Diga se vai usar harbour ou xHarbour, qual versão e qual compilador vai usar ou está usando ?
E quais os erros que está dando ao compilar ? e como e o que está usando para compilar ?
Que nem diria o Jack, vamos por parte. Você falou em xHarbour 2.0.0 o xHarbour tem apenas até a versão 1.2.1 esse 2.0.0 é o Harbour.
Diga se vai usar harbour ou xHarbour, qual versão e qual compilador vai usar ou está usando ?
E quais os erros que está dando ao compilar ? e como e o que está usando para compilar ?
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
xHarbour.org + Hwgui + PostgreSql
-
lapinhazzz
- Usuário Nível 3

- Mensagens: 130
- Registrado em: 20 Abr 2009 10:52
- Localização: LAGOA
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
eu uso o xharbour 1.0.0 e o bcc 5.5.1 e esse está funcionando, Mas não consigo imprimir imagens de acordo com o assunto que eu postei.
Baixei o xharbour 1.2.1 32 bit e o bcc 5.51 mas está dando erro com o hb_crypt. Tem algum tutorial para este xharbour. Se tiver gostaria de o ter para começar com ele.
Ajude-me.
obrigado
lapinhazzz
Baixei o xharbour 1.2.1 32 bit e o bcc 5.51 mas está dando erro com o hb_crypt. Tem algum tutorial para este xharbour. Se tiver gostaria de o ter para começar com ele.
Ajude-me.
obrigado
lapinhazzz
- sygecom
- Administrador

- Mensagens: 7131
- Registrado em: 21 Jul 2006 10:12
- Localização: Alvorada-RS
- Contato:
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Olá lapinhazzz
Nessa versão ai eu já usava impressão de imagens, post por favor como está fazendo para imprimir e as dimensões da imagem que está querendo imprimir.lapinhazzz escreveu:eu uso o xharbour 1.0.0 e o bcc 5.5.1 e esse está funcionando, Mas não consigo imprimir imagens de acordo com o assunto que eu postei.
Vamos tentar com a versão 1.0.0 primeiro, depois agente ve esse outro problema que talvez seja apenas um detalhe que esteja faltando, visto que essa função contem no xharbour 1.2.1 deve ter ficado apenas faltando linkar alguma LIB.lapinhazzz escreveu:Baixei o xharbour 1.2.1 32 bit e o bcc 5.51 mas está dando erro com o hb_crypt.
Tuturial oficial eu desconheço, mas aqui no forum tem muitas dicas valiosas, é só usar a busca para o que deseja.Tem algum tutorial para este xharbour. Se tiver gostaria de o ter para começar com ele.
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
xHarbour.org + Hwgui + PostgreSql
-
lapinhazzz
- Usuário Nível 3

- Mensagens: 130
- Registrado em: 20 Abr 2009 10:52
- Localização: LAGOA
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Estou com o xharbour 1.0.0 e o bcc55 e tento fazer isto
o que não estou conseguindo imprimir o logotipo
Peço ajuda.
Obrigado
Código: Selecionar todos
*--------------------------------------------------------------------------------------
#define FORM_A4 9
#define RGB( nR,nG,nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) )
#define PS_SOLID 0
#define BLACK RGB( 0x0 ,0x0 ,0x0 )
#define BLUE RGB( 0x0 ,0x0 ,0x85 )
#define GREEN RGB( 0x0 ,0x85,0x0 )
#define CYAN RGB( 0x0 ,0x85,0x85 )
#define RED RGB( 0x85,0x0 ,0x0 )
#define MAGENTA RGB( 0x85,0x0 ,0x85 )
#define BROWN RGB( 0x85,0x85,0x0 )
#define WHITE RGB( 0xC6,0xC6,0xC6 )
*
*--------------------------------------------------------------------------------------
FUNCTION Main()
LOCAL nPrn:=1
LOCAL aPrn:= GetPrinters()
CLS
IF EMPTY(aPrn)
Alert("No printers installed - Cannot continue")
QUIT
ENDIF
DO WHILE !EMPTY(nPrn)
CLS
@ 0,0 SAY 'Programa de teste Classe WIN32PRN(). Escolha uma impressora. ESC' +;
' para sair.'
@ 1,0 TO maxRow(),maxCol()
nPrn:= ACHOICE(2,1,maxRow()-1,maxCol()-1,aPrn,.T.,,nPrn)
IF !EMPTY(nPrn)
PrnTest(aPrn[nPrn])
ENDIF
ENDDO
*
@ 22,00 say ""
RETURN(NIL)
*
*--------------------------------------------------------------------------------------
STATIC FUNCTION PrnTest(cPrinter)
LOCAL oPrinter:= WIN32PRN():New(cPrinter), aFonts, x, nColFixed, nColTTF, ;
nColCharSet, aForms
oPrinter:Landscape:= .F.
oPrinter:FormType := FORM_A4
oPrinter:Copies := 1
*
c_string := "Teste-" + LTRIM(STR(YEAR(DATE()))) + "-" + STRZERO(MONTH(DATE()),2) +;
"-" + LTRIM(STR(DAY(DATE()))) + "=" + TIME()
*
IF !oPrinter:Create()
Alert("Cannot Create Printer")
ELSE
IF !oPrinter:startDoc( c_string )
Alert("StartDoc() failed")
ELSE
nFont := 12
oPrinter:SetFont('Courier New',12,{1,nFont}, 0, .F., .F.)
FOR N = 1 TO 2
oPrinter:NewLine()
NEXT N
*
*-----------------------------------------------------------------------------
*================================== Busca de informa‡äes =====================
oPrinter:TextOut("Impressora: " + oPrinter:PrinterName + ' ' +;
'MaxRow() = '+ltrim(STR(oPrinter:MaxRow(),4)) +;
' MaxCol() = '+ltrim(STR(oPrinter:MaxCol(),4)) , .t.)
oPrinter:NewLine()
oPrinter:SetFont('Courier New',12,{1,nFont}, 0, .F., .F.)
oPrinter:Textout(STR(oprinter:LineHeight() ) + " -altura da linha",.t.)
oPrinter:Textout(STR(oprinter:CharWidth() ) + " -largura da coluna",.T.)
oPrinter:TextOut(STR(oPrinter:Prow() ) + " -N£mero da linha",.T.)
oPrinter:TextOut(STR(oPrinter:GetCharWidth() ) + " -GetCharWidth",.T.)
oPrinter:TextOut(STR(oPrinter:GetCharHeight() ) + " -GetCharHeigth",.T.)
oPrinter:Textout(STR(oprinter:Prow() ) + " -Posi‡Æo atual da " +;
"linha",.T.)
/*
Onde:
oPrinter:TextOut("Texto a ser impresso",.T.)
1-Texto;
2-Opcional: Avan‡a linha automaticamente (.T.) ou nÆo (.F.),
sendo (.F.) o seu valor Default, quando suprimido.
*/
*======================= Aqui come‡a a impressÆo da 1¦ p gina ================
oPrinter:NewLine()
FOR nLinha = 1 TO 45
oPrinter:SetPrc(oPrinter:Prow()+01, nLinha )
oPrinter:Textout(ALLTRIM(STR(oPrinter:Prow()))+ "-linha linha linha " +;
"linha linha linha",.f.)
NEXT nLinha
*
FOR nLinha = 46 TO 100 step 2
oPrinter:SetPrc(oPrinter:Prow()+01, nLinha )
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha",.f.)
NEXT nLinha
/*
Onde:
oPrinter:SetPrc(nLinhas, nColunas)
1-N£mero de linhas do topo da p gina;
2-N£mero de colunas da margem esquerda.
oPrinter:Prow() && Linha atual.
oPrinter:Pcol() && Coluna atual.
*
Observar que as linhas que nÆo cabem na p gina sÆo descartadas,
e portanto, ‚ necess rio controlar esta situa‡Æo via software.
O mesmo acontece com as colunas que ultrapassam a largura da p gina.
*/
*======================= Aqui come‡a a impressÆo da 2¦ p gina ================
oPrinter:NewPage()
oPrinter:NewLine()
oPrinter:SetFont('Courier New',12,{1,12}, 0, .F., .F.)
/*
Onde:
oPrinter:SetFont('Courier New',12,{1,12}, 0, .F., .F.)
1-Nome da fonte;
2-Altura da fonte;
3-Multiplicador da fonte (horizontal e vertical);
4-Largura da fonte - CPI (12 character per inch);
5-Controla o Negrito-Bold (700) ou normal (.F.);
6-Controla o sublinhado (.T.) ou nÆo (.F.);
7-Controla o it lico (.T.) ou nÆo (.F.).
*/
FOR nLinha = 1 TO 70
IF nLinha = 1
n_Col := 0
oPrinter:SetFont('Courier New',14,{1,14}, 0, .F., .F.)
c_Linha := "-linha, fonte 14, {1,14} (teste 1)"
ELSEIF nLinha = 04
n_Col := 0
oPrinter:SetFont('Courier New',14,{2,14}, 0, .F., .F.)
c_Linha := "-linha, fonte 14, {2,14} (teste 2)"
ELSEIF nLinha = 08
n_Col := 0
oPrinter:SetFont('Courier New',14,{3,14}, 0, .F., .F.)
c_Linha := "-linha, fonte 14, {3,14} (teste 3)"
ELSEIF nLinha = 12
n_Col := 0
oPrinter:SetFont('Courier New',14,{4,14}, 0, .F., .F.)
c_Linha := "-linha, fonte 14, {4,14} (teste 4)"
ELSEIF nLinha = 16
n_Col := 0
oPrinter:SetFont('Courier New',14,{5,14}, 0, .F., .F.)
c_Linha := "-linha, fonte 14, {5,14} (teste 5)"
ELSEIF nLinha = 20
n_Col := 0
oPrinter:SetFont('Courier New',14,{0,14}, 0, .F., .F.)
c_Linha := "-linha, fonte 14, {0,14} (teste 6)"
ELSEIF nLinha = 24
n_Col := 0
oPrinter:NewLine()
oPrinter:SetFont('Courier New',14,{-1,14}, 0, .F., .F.)
c_Linha := "-linha normal, fonte 14, {-1,14} (teste 7)"
ELSEIF nLinha = 28
n_Col := 0
oPrinter:SetFont('Courier New',14,{-2,14}, 0, .F., .F.)
c_Linha := "-linha normal, fonte 14, {-2,14} (teste 8)"
ELSEIF nLinha = 32
n_Col := 0
oPrinter:SetFont('Courier New',14,{-3,14}, 0, .F., .F.)
c_Linha := "-linha normal, fonte 14, {-3,14} (teste 9)"
ELSEIF nLinha = 36
n_Col := 05
oPrinter:NewLine()
oPrinter:SetColor( BROWN )
oPrinter:SetFont('Courier New',12,{1,12}, 0, .F., .F.)
c_Linha := "-linha normal, fonte 12, {1,12} (teste 10)"
ELSEIF nLinha = 40
n_Col := 08
oPrinter:SetFont('Courier New',12,{1,12}, 0, .T., .F.)
c_Linha := "-linha normal, fonte 12, {1,12} (teste 11)"
ELSEIF nLinha = 44
n_Col := 11
oPrinter:SetFont('Courier New',12,{1,12}, 0, .T., .T.)
c_Linha := "-linha normal, fonte 12, {1,12} (teste 12)"
ELSEIF nLinha = 48
n_Col := 14
oPrinter:SetFont('Courier New',12,{1,12}, 0, .F., .T.)
c_Linha := "-linha normal, fonte 12, {1,12} (teste 13)"
ELSEIF nLinha = 52
n_Col := 20
oPrinter:SetFont('Courier New',14,{1,14}, 0, .T., .F.)
c_Linha := "-linha normal, fonte 14, {1,14} (teste 14)"
ELSEIF nLinha = 56
n_Col := 24
oPrinter:SetFont('Courier New',10,{1,14}, 0, .T., .F.)
c_Linha := "-linha normal, fonte 10, {1,14} (teste 15)"
ELSEIF nLinha = 60
n_Col := 28
oPrinter:SetFont('Courier New',10,{0,14}, 0, .T., .F.)
c_Linha := "-linha normal, fonte 10, {0,14} (teste 16)"
ELSEIF nLinha = 64
n_Col := 36
oPrinter:SetFont('Courier New',10,{-1,14}, 0, .T., .F.)
c_Linha := "-linha normal, fonte 10, {-1,14} (teste 17)"
ENDIF
oPrinter:SetPrc(oPrinter:Prow()+01, n_Col )
oPrinter:Textout(STRZERO(oPrinter:Prow(),02)+ c_Linha,.f.)
NEXT nLinha
oPrinter:Italic(.f.)
/*
Observar que o SUBLINHADO das linhas com fonte 12 em negrito est
suprimida por sobreposi‡Æo da linha posterior (seguinte). Ela esconde
a linha de acima. Para contornar isto deve-se diminuir o tamanho da
fonte, dar um espa‡o entre as linhas, ou ainda aumentar a altura da linha.
Basta reduzir a altura da fonte para 10 e o sublinhado j fica vis¡vel.
Vejam que o BOLD e o ITµLICO tamb‚m influem no resultado. Observe os
teste 14, 15, 16 e 17.
*/
*======================= Aqui come‡a a impressÆo da 3¦ p gina ================
oPrinter:NewPage()
oPrinter:NewLine()
oPrinter:SetFont('Courier New',10,{-1,14}, 0, .F., .F.)
FOR nLinha = 1 TO 70
IF nLinha = 1
n_Col := 0
oPrinter:SetColor( BLACK )
c_Linha := "-linha normal, cor BLACK, fonte 10, {-1,14} (teste 1)"
ELSEIF nLinha = 04
n_Col := 4
oPrinter:SetColor( BLUE )
c_Linha := "-linha normal, cor BLUE, fonte 10, {-1,14} (teste 2)"
ELSEIF nLinha = 08
n_Col := 8
oPrinter:SetColor( GREEN )
c_Linha := "-linha normal, cor GREEN, fonte 10, {-1,14} (teste 3)"
ELSEIF nLinha = 12
n_Col := 12
oPrinter:SetColor( CYAN )
c_Linha := "-linha normal, cor CYAN, fonte 10, {-1,14} (teste 4)"
ELSEIF nLinha = 16
n_Col := 16
oPrinter:SetColor( RED )
c_Linha := "-linha normal, cor RED, fonte 10, {-1,14} (teste 5)"
ELSEIF nLinha = 20
n_Col := 20
oPrinter:SetColor( MAGENTA )
c_Linha := "-linha normal, cor MAGENTA, fonte 10, {-1,14} (teste 6)"
ELSEIF nLinha = 24
n_Col := 24
oPrinter:SetColor( BROWN )
c_Linha := "-linha normal, cor BROWN, fonte 10, {-1,14} (teste 7)"
ELSEIF nLinha = 28
n_Col := 0
oPrinter:SetColor( RED )
oPrinter:SetFont('Courier New',10,{-1,14}, 0, .T., .F.)
c_Linha := "-linha sublinhada, cor RED, fonte 10, {-1,14} (teste 8)"
ELSEIF nLinha = 32
n_Col := 04
oPrinter:SetColor( BROWN )
oPrinter:SetFont('Courier New',10,{-1,14}, 700, .F., .F.)
c_Linha := "-linha negrito, cor BROWN, fonte 10, {-1,14} (teste 9)"
ELSEIF nLinha = 36
n_Col := 08
oPrinter:SetColor( MAGENTA )
oPrinter:SetFont('Courier New',10,{-1,14}, 0, .F., .T.)
c_Linha := "-linha it lico, cor MAGENTA, fonte 10, {-1,14} (teste 10)"
ELSEIF nLinha = 40
n_Col := 12
oPrinter:SetColor( CYAN )
oPrinter:SetFont('Courier New',10,{-1,14}, 700, .T., .F.)
c_Linha := "-linha negrito sublinhado, cor CYAN, fonte 10, {-1,14} " +;
"(teste 11)"
ELSEIF nLinha = 44
n_Col := 16
oPrinter:SetColor( GREEN )
oPrinter:SetFont('Courier New',10,{-1,14}, 700, .T., .T.)
c_Linha := "-linha negrito sublinhado it lico, cor GREEN, fonte 10, " +;
"{-1,14} (teste 12)"
ELSEIF nLinha = 48
n_Col := 20
oPrinter:SetColor( BLACK )
oPrinter:SetFont('Courier New',10,{-1,14})
c_Linha := "-linha negrito sublinhado it lico, cor BLACK, fonte 10, " +;
"{-1,14} (teste 13)"
ELSEIF nLinha = 52
n_Col := 24
oPrinter:Underline(.F.)
oPrinter:Italic(.T.)
oPrinter:Bold(0)
c_Linha := "-linha normal, fonte 10, {-1,14} (teste 14)"
ELSEIF nLinha = 56
n_Col := 28
c_Linha := "-linha normal, fonte 10, {1,14} (teste 15)"
ELSEIF nLinha = 60
n_Col := 32
c_Linha := "-linha normal, fonte 10, {0,14} (teste 16)"
ELSEIF nLinha = 64
n_Col := 36
c_Linha := "-linha normal, fonte 10, {-1,14} (teste 17)"
ENDIF
oPrinter:SetPrc(oPrinter:Prow()+01, n_Col )
oPrinter:Textout(STRZERO(oPrinter:Prow(),02)+ c_Linha,.f.)
NEXT nLinha
oPrinter:Italic(.f.)
*======================= Aqui come‡a a impressÆo da 4¦ p gina ================
oPrinter:NewPage()
oPrinter:NewLine()
oPrinter:NewLine()
nAltLin := oPrinter:LineHeight() && Altura da linha.
nLarCar := oPrinter:GetCharWidth() && Largura da fonte em pixels.
nAltCar := oPrinter:GetCharHeight() && Altura da fonte em pixels.
oPrinter:SetFont('Courier New',12,{1,nFont}, 0, .F., .F.)
oPrinter:TextOut(STR(nLarCar) + " " + STR(nAltCar) + " " +;
STR(nAltLin), .t.)
nRow := oPrinter:Prow() + 01
oPrinter:TextOutAt( 01*nLarCar , nRow*nAltCar ,"Coluna: "+;
ALLTRIM(STR(oPrinter:Pcol()))+"- Linha: "+;
ALLTRIM(STR(oPrinter:Prow()))+" -Seu texto vai aqui")
*======================= Aqui come‡a o uso do TextOutAt() ====================
nRow := oPrinter:Prow() + 04
nCol := 20
oPrinter:TextOutAt( nCol*nLarCar , nRow*nAltCar ,"Coluna: "+;
ALLTRIM(STR(oPrinter:Pcol()))+"- Linha: "+;
ALLTRIM(STR(oPrinter:Prow()))+" -A linha seguinte vai aqui")
oPrinter:TextOutAt(oPrinter:MM_TO_POSX(010), oPrinter:MM_TO_POSY(040), +;
"Imprimindo a 10mm da borda esquerda e 40mm da borda superior da " +;
"folha.")
*======================= Aqui come‡a o uso do TextAtFont() ===================
oPrinter:TextAtFont(oPrinter:mm_to_posx(105),oPrinter:mm_to_posy(50), +;
"Imprimindo em negrito centralizado na horizontal","Courier New", +;
10,,700,,,,,,,2)
oPrinter:TextAtFont(oPrinter:mm_to_posx(105),oPrinter:mm_to_posy(55), +;
"^ Sem negrito … direita do 105","Courier New",10,15,,,,,,,RED,0)
oPrinter:TextAtFont(oPrinter:mm_to_posx(105),oPrinter:mm_to_posy(60), +;
"Em negrito … esquerda do 105 ^","Courier New",10,10,700,,,,,,BLUE,1)
oPrinter:TextAtFont(oPrinter:mm_to_posx(105),oPrinter:mm_to_posy(65), +;
"Em negrito … esquerda do 105 ^","Courier New",10,10,700,.T.,,,,, +;
BLUE,1)
oPrinter:TextAtFont(oPrinter:mm_to_posx(105),oPrinter:mm_to_posy(70), +;
"Em negrito … esquerda do 105 ^","Courier New",10,10,700,.T., +;
.T.,,,,BLUE,1)
oPrinter:TextAtFont(oPrinter:mm_to_posx(105),oPrinter:mm_to_posy(75), +;
"Em negrito … esquerda do 105 ^","Courier New",10,10,700,.T.,.T.,0, +;
.T.,,RED,1)
/*
Onde:
1-Imprime a 105mm da margem esquerda;
2-Na linha 2;
3-Texto;
4-Fonte Courier New;
5-Tamanho da fonte, 10;
6-Divisor do tamanho da fonte;
7-O valor 700 indice Bold (negrito) ou (.F.);
8-Controla o sublinhado (.T.) ou (.F.);
9-Controla o it lico (.T.) ou (.F.);
10-nCharSet;
11-Nova linha (.T.) ou nÆo (.F.)
12-Atualiza PosX (.T.) ou nÆo (.F.)
13-Controla a cor de impressÆo;
14-O valor "2" indica impressÆo centralizada, "0" o texto seria
impresso … esquerda da posi‡Æo 105mm, e "1" o texto estaria …
direita do ponto 105 mm.
*/
*======================= Aqui come‡a a impressÆo de n£meros ==================
oPrinter:NewLine()
nNum := 95350
oPrinter:TextOut(TRANSFORM(nNum,"999,999.99"),.T.)
oPrinter:TextOut(STR(nNum),.T.)
/*
O sistema Win32prn nÆo est preparado para imprimir n£meros, portanto,
todos os n£meros deverÆo sempre ser transformados em string.
*/
*=============== Aqui come‡a impressÆo de linhas de alturas diversas =========
oPrinter:SetFont('Courier New',7,{1,18})
FOR nLinha = 1 TO 5
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 1",.T.)
NEXT nLinha
oPrinter:SetFont('Courier New',7,{2,18})
FOR nLinha = 1 TO 5
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 2",.T.)
NEXT nLinha
oPrinter:SetFont('Courier New',10,{2,18})
FOR nLinha = 1 TO 5
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 3",.T.)
NEXT nLinha
oPrinter:SetFont('Courier New',10,{3,50})
FOR nLinha = 1 TO 5
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 4",.T.)
NEXT nLinha
oPrinter:SetFont('Courier New',16,{3,18})
FOR nLinha = 1 TO 5
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 5",.T.)
NEXT nLinha
FOR nLinha = 1 TO 5
oPrinter:SetPrc(oPrinter:Prow()+01, 05 )
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 6",.T.)
NEXT nLinha
oPrinter:SetFont('Courier New',20,{3,18})
oPrinter:Bold(700)
oPrinter:Underline(.T.)
FOR nLinha = 1 TO 5
oPrinter:SetPrc(oPrinter:Prow()+01, 02 )
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 7",.T.)
NEXT nLinha
*======================= Aqui come‡a a impressÆo da 5¦ p gina ================
oPrinter:NewPage()
oPrinter:NewLine()
oPrinter:SetFont('Lucida Console',18, 0)
FOR nLinha = 1 TO 5
oPrinter:SetPrc(oPrinter:Prow()+02, 02 )
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 1",.T.)
NEXT nLinha
oPrinter:SetFont('Times',30, {3,18})
oPrinter:Underline(.F.)
FOR nLinha = 1 TO 5
oPrinter:SetPrc(oPrinter:Prow()+02, 02 )
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 2",.T.)
NEXT nLinha
oPrinter:Underline(.T.)
FOR nLinha = 1 TO 5
oPrinter:SetPrc(oPrinter:Prow()+02, 02 )
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 3",.T.)
NEXT nLinha
oPrinter:SetFont('Times New Roman',12,{1,nFont}, 0, .F., .F.)
FOR nLinha = 1 TO 5
oPrinter:Textout(ALLTRIM(STR(oprinter:Prow()))+ "-linha linha linha " +;
"linha linha linha 4",.T.)
NEXT nLinha
/*
Onde:
1-Nome da Fonte;
2-Tamanho vertical dos caracteres;
3-ExpansÆo horizontal dos caracteres;
4-CompressÆo horizontal dos caracteres.
OBS: Observar quando o tamanho da fonte ‚ maior que altura da linha, a linha
atual se sobrepäe … linha anterior, apagando parte dela. Dar 1 ou 2 linhas
em branco ‚ uma das solu‡äes.
*/
/*
oPrinter:SetPrintQuality(4)
Para setar a qualidade de impressÆo. Este recurso nÆo ‚ igual para qualquer
impressora.
H necesidade de teste para cada uma. Este comando deve ser inserido antes
da cria‡Æo do documento, ou seja, antes de 'oPrinter:Create()'.
Valores:
1-Qualidade fotogr fica;
2-Qualidade carta;
3-Qualidade m‚dia;
4-Qualidade rascunho.
*/
*======================= Aqui come‡a a impressÆo da 6¦ p gina ================
oPrinter:NewPage()
oPrinter:NewLine()
*============ ImpressÆo do C¢digos de Barras 'Bar Code' ======================
oPrinter:SetColor( BLACK )
oPrinter:SetPrc(oPrinter:Prow()+10, 05 )
oPrinter:SetFont('Barcode Font', 28, 0 )
oPrinter:TextOut(" *6920897718380* " )
oPrinter:SetFont('Courier New', 12, 0 )
oPrinter:SetPrc(oPrinter:Prow(), 40 )
oPrinter:TextOut("Barcode Font, 28, 0")
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:SetFont('Code39 Regular', 18, 0 )
oPrinter:TextOut(" *6920897718380* " )
oPrinter:SetFont('Courier New', 12, 0 )
oPrinter:SetPrc(oPrinter:Prow(), 40 )
oPrinter:TextOut("Code39 Regular, 18, 0")
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:SetFont('Code39 Regular', 18, 5 )
oPrinter:TextOut(" *6920897718380* " )
oPrinter:SetFont('Courier New', 12, 0 )
oPrinter:SetPrc(oPrinter:Prow(), 40 )
oPrinter:TextOut("Code39 Regular, 18, 5")
/*
Onde:
1-Nome da Fonte;
2-Tamanho vertical da fonte;
3-Tamanho horizontal da fonte;
*/
*============ ImpressÆo do C¢digos de Barras '3 de 9 Barcode' ================
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(100 ), +;
'1234567890', '3 of 9 Barcode', 28, 05 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 120 ) , +;
oPrinter:MM_TO_POSY(100 ),'3 of 9 Barcode, 28, 05', +;
'Courier New', 12, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(120 ), +;
'1234567890', '3 of 9 Barcode', 40, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 120 ) , +;
oPrinter:MM_TO_POSY(120 ),'3 of 9 Barcode, 40, 0', +;
'Courier New', 12, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(140 ), +;
'1234567890', '3 of 9 Barcode', 40, 10 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 120 ) , oPrinter:MM_TO_POSY(140 ), +;
'3 of 9 Barcode, 40, 10','Courier New', 12, 0 )
*============ ImpressÆo do C¢digos de Barras 'Barcoding' =====================
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(160 ), +;
'1234567890', 'Barcoding', 40, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 120 ) , +;
oPrinter:MM_TO_POSY(160 ),'Barcoding, 40, 0','Courier New', 12, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(180 ), +;
'1234567890', 'Barcoding', 40, 5 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 120 ) , oPrinter:MM_TO_POSY(180 ), +;
'Barcoding, 40, 5','Courier New', 12, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(200 ), +;
'1234567890', 'Barcoding', 40, 10 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 120 ) , +;
oPrinter:MM_TO_POSY(200 ),'Barcoding, 40, 10','Courier New', 12, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(220 ), +;
'1234567890', 'Barcoding', 40, 15 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 120 ) , +;
oPrinter:MM_TO_POSY(220 ),'Barcoding, 40, 15','Courier New', 12, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 20 ) , oPrinter:MM_TO_POSY(240 ), +;
'As fontes dos diversos C¢digos de Barra podem ser ' +;
'baixados de:','Courier New', 12, 0 )
oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 20 ) , oPrinter:MM_TO_POSY(245 ), +;
'http: //www.netfontes.com.br/fontes.php/categ_7.10' +;
'.htm','Courier New', 12, 0 )
/*
Onde:
1-Coordenada horizontal em mm;
2-Coordenada vertical em mm;
3-Texto;
4-Nome da Fonte;
5-Tamanho da fonte;
6-Divisor da largura da Barra.
As Fontes dos C¢digos de Barras podem ser baixadas de:
http://www.netfontes.com.br/fontes.php/categ_7.10.htm
*/
*======================= Aqui come‡a a impressÆo da 7¦ p gina ================
oPrinter:NewPage()
oPrinter:Box( 300, 200, 800, 1000 )
oPrinter:Box( 600, 1200, 1500, 2000 )
oPrinter:Box( 600, 2200, 1500, 3000, 200, 600 )
oPrinter:SetFont('Courier New', 10, 0 )
oPrinter:SetPrc( 04 , 20 )
oPrinter:TextOut("X(coluna) -> 300 , Y(linha) -> 200 x " +;
"X(coluna) -> 800 , Y(linha) -> 1000",.T.)
oPrinter:SetPrc( 09 , 20 )
oPrinter:TextOut("X(coluna) -> 600 , Y(linha) -> 1200 x " +;
"X(coluna) -> 1500 , Y(linha) -> 2000",.T.)
oPrinter:SetPrc( 13 , 20 )
oPrinter:TextOut("X(coluna) -> 600 , Y(linha) -> 1200 x " +;
"X(coluna) -> 1500 , Y(linha) -> 2000",.T.)
oPrinter:SetPrc( 14 , 20 )
oPrinter:TextOut("Arred. hor. 200, Arred. vert. 600",.T.)
/*
Onde temos valores em pixels:
Box(nX1, nY1, nX2, nY2, nWidth, nHeight);
coluna, linha, coluna, linha, nWidth, nHeight;
exemplificando o tamanho do BOX acima:
500 x 800, ou seja, 800-300=300(largura) x 1000- 200=800(altura);
900 x 800, ou seja, 1500-600=900(largura) x 2000-1500=800(altura);
nWidth -> arredondamento na linha horizontal;
nHeight -> arredondamento na linha vertical.
*/
nPosY := oPrinter:PosY
nPosX := oPrinter:PosX
oPrinter:SetPrc( 18 , 05 )
oPrinter:TextOut("'oPrinter:posY' determina a posi‡Æo atual da coordenada " +;
"Y -> linha)", .T.)
oPrinter:SetPrc( 19 , 05 )
oPrinter:TextOut("'oPrinter:posX' determina a posi‡Æo atual da coordenada " +;
"X -> coluna)", .T.)
nPosCol := 100 && In¡cio horizontal do BOX;
nLin := 700 && Altura do BOX;
nCol := 300 && Largura do BOX.
nX1 := oPrinter:PosX + nPosCol
nY1 := oPrinter:PosY
nX2 := nX1 + nCol
nY2 := nY1 + nLin
oPrinter:SetPrc( 23 , 10 )
oPrinter:TextOut("Coordenadas: " + str(nX1) + str(nY1) + str(nX2) + ;
str(nY2), .T.)
oPrinter:Box( nX1 , nY1 , nX2, nY2 )
*======================= Aqui come‡a a impressÆo ARC =========================
oPrinter:Arc( 600, oPrinter:PosY+200, 800, oPrinter:PosY+700)
oPrinter:SetPrc( 27 , 10 )
oPrinter:TextOut("Coordenadas: " + str(600) + str(oPrinter:PosY+200) + ;
str(800) + str(oPrinter:PosY+700), .T.)
*======================= Aqui come‡a a impressÆo ELLIPSE =====================
oPrinter:Ellipse( 1000, oPrinter:PosY+200, 1600, oPrinter:PosY+500)
oPrinter:SetPrc( 30 , 20 )
oPrinter:TextOut("Coordenadas: " + str(1000) + str(oPrinter:PosY+200) +;
str(1600) + str(oPrinter:PosY+500), .T.)
*======================= Aqui come‡a a impressÆo FILLTEXT ====================
oPrinter:FillRect(2000, oPrinter:PosY+200, 3000, oPrinter:PosY+600, RED)
oPrinter:SetPrc( 33 , 35 )
oPrinter:TextOut("Coordenadas: " + str(2000) + str(oPrinter:PosY+200) +;
str(3000) + str(oPrinter:PosY+600), .T.)
/*
Notar que os RET¶NGULOS, ELIPSES, etc. desta £ltima p gina podem necessitar
de alguns acertos nas coordenadas, visto que foram estabelecidas para documento
PDF. Para minha impressora EPSON nÆo produziu o mesmo resultado.
*/
*======================= Aqui come‡a a impressÆo de Imagens ===================
oBmp := Win32Prn():new()
cFileName := "c:\ca6\sol.bmp"
oBmp := Win32Bmp():new()
IF .NOT. oBmp:loadFile( cFileName )
Alert( cFileName + " N’o encontrado..." )
ELSE
oBmp:draw( oPrinter, { 1200, 7500, 1800, 1500 } )
oPrinter:SetFont('Courier New',14,{1,14}, 0, .F., .F.)
oPrinter:SetPrc(oPrinter:Prow()+08, 40 )
oPrinter:TextOut("Öcone impresso nas coordenadas: horizontal 1200, vertical 7500", .T.)
oPrinter:SetPrc(oPrinter:Prow()+01, 40 )
oPrinter:TextOut("Tamanho do ¡cone: horizontal 1800, vertical 1500", .T.)
ENDIF
*====================== Usando sub-rotina para a impressÆo da imagem ========
cBmpFile := "c:\ca6\sol.bmp"
PrintBitMap( oPrinter, cBMPFile )
oPrinter:EndDoc()
ENDIF
oPrinter:Destroy()
ENDIF
RETURN(NIL)
*
*------------------------------------------------------------------------------
procedure PrintBitMap( oPrn, cBitFile )
LOCAL oBMP
IF EMPTY( cBitFile )
&& Pode-se incluir aqui uma imagem alternativa.
ELSEIF !FILE( cBitFile )
Alert( "Arquivo " + cBitFile + " nÆo encontrado." )
ELSE
oBMP:= Win32BMP():new()
IF oBmp:loadFile( cBitFile )
oBmp:Draw( oPrn, { 200,10000, 1000, 750 } )
&& Esta alternativa abaixo que tamb‚m pode ser usada.
oBmp:Rect:= { 2000,10000, 1000, 750 }
oPrn:DrawBitMap( oBmp )
ENDIF
oBMP:Destroy()
ENDIF
RETURN
*
*---------------------------------------------------------------------------------------------------
Peço ajuda.
Obrigado
- sygecom
- Administrador

- Mensagens: 7131
- Registrado em: 21 Jul 2006 10:12
- Localização: Alvorada-RS
- Contato:
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Esse arquivo SOL.BMP está no local "c:\ca6\sol.bmp" está no caminho certo ? e quais as dimensões desse arquivo ?
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
xHarbour.org + Hwgui + PostgreSql
-
lapinhazzz
- Usuário Nível 3

- Mensagens: 130
- Registrado em: 20 Abr 2009 10:52
- Localização: LAGOA
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Bom Dia Sagecom e a todos do forum.
O Ficheiro sol.bmp está mesmo nessa pasta e o tamanho ronda mais ou menos os 2 megabytes (é o sol que está nos meus documentos e em imagens.
Será que é muito grande?
Também fiz o download do xharbour 1.2.0 e tenho problemas com o dbedit que começa a tremer e hb_crypt não existe nesta versão.
Obrigado
lapinhazzz
O Ficheiro sol.bmp está mesmo nessa pasta e o tamanho ronda mais ou menos os 2 megabytes (é o sol que está nos meus documentos e em imagens.
Será que é muito grande?
Também fiz o download do xharbour 1.2.0 e tenho problemas com o dbedit que começa a tremer e hb_crypt não existe nesta versão.
Obrigado
lapinhazzz
- sygecom
- Administrador

- Mensagens: 7131
- Registrado em: 21 Jul 2006 10:12
- Localização: Alvorada-RS
- Contato:
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
lapinhazzz escreveu: O Ficheiro sol.bmp está mesmo nessa pasta e o tamanho ronda mais ou menos os 2 megabytes (é o sol que está nos meus documentos e em imagens.
Será que é muito grande?
Não perguntei o tamanho em KByts do arquivo e sim as dimensões da imagem, por você no exemplo está tentando imprimir uma imagem em colunas que talvez não exista na pagina de impressão, por isso não deve está imprimindo.
Sobre o problema do DBEDIT eu não sei lhe dizer por que não uso mais DBEDIT a muito tempo, e o hb_crypt() existe sim nessa versão, inclusive eu uso essa função, muito provável você esteja esquecendo de linkar alguma LIB.lapinhazzz escreveu: Também fiz o download do xharbour 1.2.0 e tenho problemas com o dbedit que começa a tremer e hb_crypt não existe nesta versão.
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
xHarbour.org + Hwgui + PostgreSql
-
lapinhazzz
- Usuário Nível 3

- Mensagens: 130
- Registrado em: 20 Abr 2009 10:52
- Localização: LAGOA
Re: win32prn() e adobe 9.3.0 pdfcreator 1.2.0
Boa Tarde.
Já consegui.
Depois vou postar o código.
obrigado
lapinhazzz
Já consegui.
Depois vou postar o código.
obrigado
lapinhazzz
- Anexos
-
MV_IMP.PRG- (14.74 KiB) Baixado 251 vezes
