convert draw line to HPDFPRINT LINE

Moderator: Rathinagiri

Post Reply
User avatar
jairpinho
Posts: 209
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 1 time
Contact:

convert draw line to HPDFPRINT LINE

Post by jairpinho » Thu Sep 07, 2017 1:52 am

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
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » 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

User avatar
jairpinho
Posts: 209
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 1 time
Contact:

Post by jairpinho » Thu Sep 07, 2017 6:26 pm

mol 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
could describe the variables
nMaxRowHeight ?
nHeight ?
nWidth ?

check my code
tendencia.zip
(1.71 KiB) Downloaded 7 times

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
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Thu Sep 07, 2017 7:08 pm

These are my private variables computed via application. Nothing special. That's a piece of code which really works ok

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Thu Sep 07, 2017 7:11 pm

jairpinho wrote:
Thu Sep 07, 2017 6:26 pm
mol 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
could describe the variables
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
You didn't attach mathematica.fmg file.

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » 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

User avatar
jairpinho
Posts: 209
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 1 time
Contact:

Post by jairpinho » Thu Sep 07, 2017 10:17 pm

mol 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
I need the pdf to be the same as the lines generated with draw line
prg manual
tendencia.zip
(2.39 KiB) Downloaded 7 times

prg auto
Main.zip
(3.51 KiB) Downloaded 11 times
graph.png
graph.png (74.82 KiB) Viewed 203 times
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

Post Reply