Print .jpg in pdf print

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
franco
Posts: 371
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 11 times

Print .jpg in pdf print

Post by franco » Thu Nov 07, 2019 5:38 pm

Can anyone help
I have a folder with a jpg file called A1234.jpg.
This file prints to printer but not to pdf.
The code as follows

Code: Select all

#include <hmg.ch>

Function Main
local pl := 0, lsuccess := .F., pd := .F., PDP := '', PAGE := 0


pimage:= 'P1234.jpg'


	IF MSGYESNO('Do you Want To PDF (Y/N) ? ')
		*PD := .T.
		PDP := 'A1234'                     //SUBSTR(CUSTOMER->NAME,1,AT(SPACE(1),CUSTOMER->NAME)-1)
		PDP :=  PDP+'.PDF'                        //GETCURRENTFOLDER()+'\SEND\'+PDP+'.PDF'
		IF FILE(PDP)
			DELETE  FILE(PDP)
		ENDIF
		SELECT PRINTER PDF PDP TO LSUCCESS     
				IF ! lSuccess .OR. LEN(ALLTRIM(PDP)) < 1
					MSGINFO('PDF File Not Available')
					RETURN
				ENDIF
	ELSE
		SELECT  PRINTER DEFAULT TO lSUCCESS preview ;
		ORIENTATION PRINTER_ORIENT_PORTRAIT ;
		PAPERSIZE PRINTER_PAPER_LETTER ;
		QUALITY PRINTER_RES_MEDIUM
	ENDIF
	
	IF LSUCCESS == .F.
		MSGINFO('Printer Not Available')
		RETURN
	ENDIF
	
		START PRINTDOC
		START PRINTPAGE
 
		PL := 8
		@ PL,10 PRINT ' Hello to all:' 
		@ PL,170 PRINT 'Date: '+DTOC(DATE()) SIZE 12
		PL:= PL+20
		IF FILE(PIMAGE)
			@ PL,10 PRINT IMAGE PIMAGE WIDTH 80 HEIGHT 60 STRETCH
		ENDIF 
		@ 100,90 PRINT 'End of Report:'

	END PRINTPAGE
	END PRINTDOC

Return
Thanks in advance,
Franco
Franco Bushie
Canada

User avatar
jairpinho
Posts: 347
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 11 times
Contact:

Post by jairpinho » Thu Nov 07, 2019 10:55 pm

franco wrote:
Thu Nov 07, 2019 5:38 pm
Can anyone help
I have a folder with a jpg file called A1234.jpg.
This file prints to printer but not to pdf.
The code as follows

Code: Select all

#include <hmg.ch>

Function Main
local pl := 0, lsuccess := .F., pd := .F., PDP := '', PAGE := 0


pimage:= 'P1234.jpg'


	IF MSGYESNO('Do you Want To PDF (Y/N) ? ')
		*PD := .T.
		PDP := 'A1234'                     //SUBSTR(CUSTOMER->NAME,1,AT(SPACE(1),CUSTOMER->NAME)-1)
		PDP :=  PDP+'.PDF'                        //GETCURRENTFOLDER()+'\SEND\'+PDP+'.PDF'
		IF FILE(PDP)
			DELETE  FILE(PDP)
		ENDIF
		SELECT PRINTER PDF PDP TO LSUCCESS     
				IF ! lSuccess .OR. LEN(ALLTRIM(PDP)) < 1
					MSGINFO('PDF File Not Available')
					RETURN
				ENDIF
	ELSE
		SELECT  PRINTER DEFAULT TO lSUCCESS preview ;
		ORIENTATION PRINTER_ORIENT_PORTRAIT ;
		PAPERSIZE PRINTER_PAPER_LETTER ;
		QUALITY PRINTER_RES_MEDIUM
	ENDIF
	
	IF LSUCCESS == .F.
		MSGINFO('Printer Not Available')
		RETURN
	ENDIF
	
		START PRINTDOC
		START PRINTPAGE
 
		PL := 8
		@ PL,10 PRINT ' Hello to all:' 
		@ PL,170 PRINT 'Date: '+DTOC(DATE()) SIZE 12
		PL:= PL+20
		IF FILE(PIMAGE)
			@ PL,10 PRINT IMAGE PIMAGE WIDTH 80 HEIGHT 60 STRETCH
		ENDIF 
		@ 100,90 PRINT 'End of Report:'

	END PRINTPAGE
	END PRINTDOC

Return
Thanks in advance,
Franco
hello

Code: Select all


pimage: "P1234.jpg"
@ PL,10 PRINT IMAGE PIMAGE WIDTH 80 HEIGHT 60 STRETCH

or 

@ PL,10 PRINT IMAGE PIMAGE WIDTH 80 HEIGHT 60 TYPE JPG STRETCH

or

@ PL,10 PRINT IMAGE PIMAGE WIDTH 80 HEIGHT 60


Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

franco
Posts: 371
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 11 times

Post by franco » Fri Nov 08, 2019 10:24 am

Thank you , Jair
TYPE JPG makes it work for me.
Franco
Franco Bushie
Canada

User avatar
HASA
Posts: 37
Joined: Sat Feb 23, 2013 3:00 pm
Location: SÃO PAULO - BRAZIL

Post by HASA » Fri Nov 08, 2019 4:12 pm

Friends, you can set an image as a watermark?

HASA

franco
Posts: 371
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 11 times

Post by franco » Tue Nov 12, 2019 5:54 am

How would you do this ?.
Now I still can not print a file created by my programmed camera inside hmg to a pdf.
If I use a image from an outside camera or a picture off the internet it will work, but if I use a picture created in hmg from my lap top camera
I still get the message Can not load image
I think it is something to do with webcam.html. Is there a stand alone webcam.html as everyone is moving away from flash. I can not get flash to work more then one time and it has to ask me if I want to use it.
Any help appreciated.
Franco
Franco Bushie
Canada

Post Reply