I have a graph on the screen created with draw line I need to generate this graph in a pdf file I'm trying HPDFPRINT LINE without success
draw line in at x1,x2 to y1,y2
@ row ,col hpdfprint line to tRow , tCol
convert draw line to HPDFPRINT LINE
Moderator: Rathinagiri
Re: convert draw line to HPDFPRINT LINE
In my app, code like this, works OK:
Code: Select all
@ nRow, nCol HPDFPRINT LINE to nRow+nMaxRowHeight+nHeight, nCol+nWidth ;
PENWIDTH 0.1 COLOR BLACK
Re: convert draw line to HPDFPRINT LINE
could describe the variablesmol wrote: ↑Thu Sep 07, 2017 5:44 am In my app, code like this, works OK:Code: Select all
@ nRow, nCol HPDFPRINT LINE to nRow+nMaxRowHeight+nHeight, nCol+nWidth ; PENWIDTH 0.1 COLOR BLACK
nMaxRowHeight ?
nHeight ?
nWidth ?
check my code
Code: Select all
function drawshapes()
local lSuccess := .f.
local cLB := chr( 10 )
lOCAL cArquivo, cData
Local cFonte1:= "Helvetica"
Local nFonte_size00 := 8
Local nFonte_size0 := 9
Local nFonte_size1 := 10
Local nFonte_size2 := 11
Local nFonte_size3 := 12
Local nFonte_size4 := 14
Local nFonte_size5 := 15
Local I := 1
LOCAL x_x1 := 500 , x_y1 := 300 , x_x2:= 500 , x_y2:= 800
LOCAL y_x1 := 30 , y_y1 := 400 , y_x2:= 600 , y_y2:= 400
local x1:=mathematica.text_1.value
local y1:=mathematica.text_2.value
x2 := mathematica.text_3.value // tempo decorrente
y2:= mathematica.text_4.value // tempo decorrente
draw line in window mathematica at x_x1-y1,y_y2+x1 to x_x1-y2,y_y2+x2 pencolor {255,0,0} penwidth 2
//x2:= x1
//y2:= y1
cArquivo:= DiskName()+ ":\"+CurDir() + "\Relatorio"+ ".pdf"
SELECT HPDFDOC cArquivo TO lSuccess ORIENTATION HPDF_ORIENT_LANDSCAPE PAPERSIZE HPDF_PAPER_A4
SET HPDFDOC COMPRESS ALL
SET HPDFDOC PAGEMODE TO OUTLINE
SET HPDFINFO AUTHOR TO 'Jair Pinho'
SET HPDFINFO CREATOR TO 'Jair Pinho'
SET HPDFINFO TITLE TO 'Relaório'
SET HPDFINFO SUBJECT TO 'Criado com LibHaru/HPDF Library'
SET HPDFINFO KEYWORDS TO 'HMG, HPDF, Documentation, LibHaru, Harbour, MiniGUI'
SET HPDFINFO DATECREATED TO date() TIME time()
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
if lSuccess
START HPDFPAGE
SET HPDFDOC PAGEOUTLINE TITLE "Relatorio de Tendencias"
@ 140 , 010 HPDFPRINT LINE TO 140 , 280 PENWIDTH 0.5 COLOR { 255, 0, 0 } // linha x mm inicia em cima top = 0
@ 010 , 050 HPDFPRINT LINE TO 160 , 050 PENWIDTH 0.5 COLOR { 255, 0, 0 } // linha y mm inicia em cima top = 0
@ 297-x1, 210-y1 HPDFPRINT LINE TO 297-x2 , 210-y2 PENWIDTH 2 COLOR { 255, 0, 0 }
END HPDFPAGE
END HPDFDOC
endif
execute file cArquivo
Return
Re: convert draw line to HPDFPRINT LINE
These are my private variables computed via application. Nothing special. That's a piece of code which really works ok
Re: convert draw line to HPDFPRINT LINE
You didn't attach mathematica.fmg file.jairpinho wrote: ↑Thu Sep 07, 2017 6:26 pmcould describe the variablesmol wrote: ↑Thu Sep 07, 2017 5:44 am In my app, code like this, works OK:Code: Select all
@ nRow, nCol HPDFPRINT LINE to nRow+nMaxRowHeight+nHeight, nCol+nWidth ; PENWIDTH 0.1 COLOR BLACK
nMaxRowHeight ?
nHeight ?
nWidth ?
check my code tendencia.zip
Code: Select all
function drawshapes() local lSuccess := .f. local cLB := chr( 10 ) lOCAL cArquivo, cData Local cFonte1:= "Helvetica" Local nFonte_size00 := 8 Local nFonte_size0 := 9 Local nFonte_size1 := 10 Local nFonte_size2 := 11 Local nFonte_size3 := 12 Local nFonte_size4 := 14 Local nFonte_size5 := 15 Local I := 1 LOCAL x_x1 := 500 , x_y1 := 300 , x_x2:= 500 , x_y2:= 800 LOCAL y_x1 := 30 , y_y1 := 400 , y_x2:= 600 , y_y2:= 400 local x1:=mathematica.text_1.value local y1:=mathematica.text_2.value x2 := mathematica.text_3.value // tempo decorrente y2:= mathematica.text_4.value // tempo decorrente draw line in window mathematica at x_x1-y1,y_y2+x1 to x_x1-y2,y_y2+x2 pencolor {255,0,0} penwidth 2 //x2:= x1 //y2:= y1 cArquivo:= DiskName()+ ":\"+CurDir() + "\Relatorio"+ ".pdf" SELECT HPDFDOC cArquivo TO lSuccess ORIENTATION HPDF_ORIENT_LANDSCAPE PAPERSIZE HPDF_PAPER_A4 SET HPDFDOC COMPRESS ALL SET HPDFDOC PAGEMODE TO OUTLINE SET HPDFINFO AUTHOR TO 'Jair Pinho' SET HPDFINFO CREATOR TO 'Jair Pinho' SET HPDFINFO TITLE TO 'Relaório' SET HPDFINFO SUBJECT TO 'Criado com LibHaru/HPDF Library' SET HPDFINFO KEYWORDS TO 'HMG, HPDF, Documentation, LibHaru, Harbour, MiniGUI' SET HPDFINFO DATECREATED TO date() TIME time() SET HPDFDOC ENCODING TO "WinAnsiEncoding" if lSuccess START HPDFPAGE SET HPDFDOC PAGEOUTLINE TITLE "Relatorio de Tendencias" @ 140 , 010 HPDFPRINT LINE TO 140 , 280 PENWIDTH 0.5 COLOR { 255, 0, 0 } // linha x mm inicia em cima top = 0 @ 010 , 050 HPDFPRINT LINE TO 160 , 050 PENWIDTH 0.5 COLOR { 255, 0, 0 } // linha y mm inicia em cima top = 0 @ 297-x1, 210-y1 HPDFPRINT LINE TO 297-x2 , 210-y2 PENWIDTH 2 COLOR { 255, 0, 0 } END HPDFPAGE END HPDFDOC endif execute file cArquivo Return
Re: convert draw line to HPDFPRINT LINE
I've donloaded your sample, I've cutted every piece of code which draws in mathematica form and I got .pdf file with to line - horizontal and vertical with width 0.5 mm.
Then I've changed horizontal line to 5 mm and I got it.
Then I've changed horizontal line to 5 mm and I got it.
Code: Select all
#include "hmg.ch"
function main
LOCAL x_x1 := 500 , x_y1 := 300 , x_x2:= 500 , x_y2:= 800
LOCAL y_x1 := 30 , y_y1 := 400 , y_x2:= 600 , y_y2:= 400
Private x2 := 0 //inicializa com zero e depois a funcao incrementa
Private y2 := 0 // inicializa com zero e depois a funcao incrementa
private pos := .f.
/*
IF !IsWindowDefined(mathematica)
Load Window mathematica
draw line in window mathematica at x_x1,x_y1 to x_x2,x_y2 pencolor {0,0,0} penwidth 1 // linha x
draw line in window mathematica at y_x1,y_y1 to y_x2,y_y2 pencolor {0,0,0} penwidth 1 // linha y
Center WINDOW mathematica
ACTIVATE WINDOW mathematica
Else
mathematica.Center
mathematica.Restore
Return
Endif
*/
drawshapes()
return nil
function drawshapes()
local lSuccess := .f.
local cLB := chr( 10 )
lOCAL cArquivo, cData
Local cFonte1:= "Helvetica"
Local nFonte_size00 := 8
Local nFonte_size0 := 9
Local nFonte_size1 := 10
Local nFonte_size2 := 11
Local nFonte_size3 := 12
Local nFonte_size4 := 14
Local nFonte_size5 := 15
Local I := 1
LOCAL x_x1 := 500 , x_y1 := 300 , x_x2:= 500 , x_y2:= 800
LOCAL y_x1 := 30 , y_y1 := 400 , y_x2:= 600 , y_y2:= 400
//local x1:=mathematica.text_1.value
//local y1:=mathematica.text_2.value
y1 := 10
x1:=10
// x2 := mathematica.text_3.value // tempo decorrente
// y2:= mathematica.text_4.value // tempo decorrente
//draw line in window mathematica at x_x1-y1,y_y2+x1 to x_x1-y2,y_y2+x2 pencolor {255,0,0} penwidth 2
//
//x2:= x1
//y2:= y1
cArquivo:= DiskName()+ ":\"+CurDir() + "\Relatorio"+ ".pdf"
SELECT HPDFDOC cArquivo TO lSuccess ORIENTATION HPDF_ORIENT_LANDSCAPE PAPERSIZE HPDF_PAPER_A4
SET HPDFDOC COMPRESS ALL
SET HPDFDOC PAGEMODE TO OUTLINE
SET HPDFINFO AUTHOR TO 'Jair Pinho'
SET HPDFINFO CREATOR TO 'Jair Pinho'
SET HPDFINFO TITLE TO 'Relaório'
SET HPDFINFO SUBJECT TO 'Criado com LibHaru/HPDF Library'
SET HPDFINFO KEYWORDS TO 'HMG, HPDF, Documentation, LibHaru, Harbour, MiniGUI'
SET HPDFINFO DATECREATED TO date() TIME time()
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
if lSuccess
START HPDFPAGE
SET HPDFDOC PAGEOUTLINE TITLE "Relatorio de Tendencias"
@ 140 , 010 HPDFPRINT LINE TO 140 , 280 PENWIDTH 5 COLOR { 255, 0, 0 } // linha x mm inicia em cima top = 0
@ 010 , 050 HPDFPRINT LINE TO 160 , 050 PENWIDTH 0.5 COLOR { 255, 0, 0 } // linha y mm inicia em cima top = 0
@ 297-x1, 210-y1 HPDFPRINT LINE TO 297-x2 , 210-y2 PENWIDTH 2 COLOR { 255, 0, 0 }
END HPDFPAGE
END HPDFDOC
endif
execute file cArquivo
Return
Re: convert draw line to HPDFPRINT LINE
I need the pdf to be the same as the lines generated with draw linemol wrote: ↑Thu Sep 07, 2017 7:18 pm I've donloaded your sample, I've cutted every piece of code which draws in mathematica form and I got .pdf file with to line - horizontal and vertical with width 0.5 mm.
Then I've changed horizontal line to 5 mm and I got it.Code: Select all
#include "hmg.ch" function main LOCAL x_x1 := 500 , x_y1 := 300 , x_x2:= 500 , x_y2:= 800 LOCAL y_x1 := 30 , y_y1 := 400 , y_x2:= 600 , y_y2:= 400 Private x2 := 0 //inicializa com zero e depois a funcao incrementa Private y2 := 0 // inicializa com zero e depois a funcao incrementa private pos := .f. /* IF !IsWindowDefined(mathematica) Load Window mathematica draw line in window mathematica at x_x1,x_y1 to x_x2,x_y2 pencolor {0,0,0} penwidth 1 // linha x draw line in window mathematica at y_x1,y_y1 to y_x2,y_y2 pencolor {0,0,0} penwidth 1 // linha y Center WINDOW mathematica ACTIVATE WINDOW mathematica Else mathematica.Center mathematica.Restore Return Endif */ drawshapes() return nil function drawshapes() local lSuccess := .f. local cLB := chr( 10 ) lOCAL cArquivo, cData Local cFonte1:= "Helvetica" Local nFonte_size00 := 8 Local nFonte_size0 := 9 Local nFonte_size1 := 10 Local nFonte_size2 := 11 Local nFonte_size3 := 12 Local nFonte_size4 := 14 Local nFonte_size5 := 15 Local I := 1 LOCAL x_x1 := 500 , x_y1 := 300 , x_x2:= 500 , x_y2:= 800 LOCAL y_x1 := 30 , y_y1 := 400 , y_x2:= 600 , y_y2:= 400 //local x1:=mathematica.text_1.value //local y1:=mathematica.text_2.value y1 := 10 x1:=10 // x2 := mathematica.text_3.value // tempo decorrente // y2:= mathematica.text_4.value // tempo decorrente //draw line in window mathematica at x_x1-y1,y_y2+x1 to x_x1-y2,y_y2+x2 pencolor {255,0,0} penwidth 2 // //x2:= x1 //y2:= y1 cArquivo:= DiskName()+ ":\"+CurDir() + "\Relatorio"+ ".pdf" SELECT HPDFDOC cArquivo TO lSuccess ORIENTATION HPDF_ORIENT_LANDSCAPE PAPERSIZE HPDF_PAPER_A4 SET HPDFDOC COMPRESS ALL SET HPDFDOC PAGEMODE TO OUTLINE SET HPDFINFO AUTHOR TO 'Jair Pinho' SET HPDFINFO CREATOR TO 'Jair Pinho' SET HPDFINFO TITLE TO 'Relaório' SET HPDFINFO SUBJECT TO 'Criado com LibHaru/HPDF Library' SET HPDFINFO KEYWORDS TO 'HMG, HPDF, Documentation, LibHaru, Harbour, MiniGUI' SET HPDFINFO DATECREATED TO date() TIME time() SET HPDFDOC ENCODING TO "WinAnsiEncoding" if lSuccess START HPDFPAGE SET HPDFDOC PAGEOUTLINE TITLE "Relatorio de Tendencias" @ 140 , 010 HPDFPRINT LINE TO 140 , 280 PENWIDTH 5 COLOR { 255, 0, 0 } // linha x mm inicia em cima top = 0 @ 010 , 050 HPDFPRINT LINE TO 160 , 050 PENWIDTH 0.5 COLOR { 255, 0, 0 } // linha y mm inicia em cima top = 0 @ 297-x1, 210-y1 HPDFPRINT LINE TO 297-x2 , 210-y2 PENWIDTH 2 COLOR { 255, 0, 0 } END HPDFPAGE END HPDFDOC endif execute file cArquivo Return
prg manual
prg auto