Could someone help figure this out'
This code works if:
1. I print it to printer and then in preview save to disk as pdf, then go out of program.
2. take picture then go out of program and edit picture with paint and do nothing but save as pdf. The file is much smaller then original.
Then I go back in program and do not take a new picture. Then print to pdf. It now works.
You need a laptop or windows tablet to use this so you can take a picture with internal camera.
If I use external camera or any hmg pre-printed jpeg files it works;
Put this code in a folder and complile or build with. build.bat
build.bat in this folder
@ECHO OFF
call c:\hmg.3.4.4\build.bat main %*
you will also need CAMERA.SWF in this folder
Code: Select all
#include <hmg.ch>
Function Main
LOCAL PD := .F.
IF ! FILE('WEBCAM.HTML')
WEBCAM('WEBCAM','CAMERA.SWF','300','300')
ENDIF
READYCAM()
IF MSGYESNO('Do You Want to Print to PDF')
PD := .T.
SELECT PRINTER PDF 'MiPDF.pdf' TO lSuccess
IF LSUCCESS == .F.
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 10
PL:= PL+20
IF FILE(getcurrentfolder()+'\test.jpg')
@ PL,10 PRINT IMAGE getcurrentfolder()+'\TEST.JPG' WIDTH 80 HEIGHT 60 TYPE JPG
ENDIF
@ 100,90 PRINT 'End of Report:'
END PRINTPAGE
END PRINTDOC
IF PD = .T.
EXECUTE FILE 'MIPDF.PDF'
ENDIF
PD := .F.
Return
FUNCTION READYCAM(PICT)
IF !ISWINDOWACTIVE(CAMFORM) //330 (GETDESKTOPwidth())-35
DEFINE WINDOW CAMFORM AT 65,30 WIDTH 620 HEIGHT 310 TITLE 'Shot Image ** Escape to Cancel' ICON 'WEBCAM.ICO' MODAL SYSMENU .F. ;
BACKCOLOR (143,200,220)
ON KEY ESCAPE OF CAMFORM ACTION {||{ANS := 'F'},{CAMFORM.RELEASE}}
DEFINE ACTIVEX ACTIVEX2
ROW 10
COL 7
HEIGHT 300 //230 //300
WIDTH 230
PROGID "SHELL.EXPLORER.2"
END ACTIVEX
DEFINE BUTTON BUTTON1
ROW 5 //250
COL 350 //120
WIDTH 100
HEIGHT 100 //28
ACTION SNAPSHOT()
CAPTION "Snap Shot"
PICTURE 'CAMERA'
FONTNAME "Arial"
FONTSIZE 10
*visible .F.
END BUTTON
DEFINE BUTTON BUTTON2
ROW 160 //250
COL 350 //170 //120
WIDTH 100
HEIGHT 100 //28
ACTION {||{ANS := 'F'},{CAMFORM.RELEASE}}
CAPTION "Exit"
PICTURE 'hp_close'
FONTNAME "Arial"
FONTSIZE 10
*visible .F.
END BUTTON
END WINDOW
CAMFORM.ACTIVEX2.OBJECT:NAVIGATE(GETCURRENTFOLDER()+"\WEBCAM.HTML")
CAMFORM.ACTIVATE
ELSE
MSGBOX('Not Available')
ENDIF
RETURN
FUNCTION SNAPSHOT
CAMFORM.CAPTURE('TEST.JPG',15,7,300,230)
PLAYBEEP()
CAMFORM.RELEASE
RETURN
FUNCTION WEBCAM
PRIVATE _cfile, _cimage, _cwidth, _cheight
PARAMETER _cfile, _cimage, _cwidth, _cheight
_cfile:=_cfile+".html"
TEXT TO FILE &_cfile
<html>
<body style="overflow: hidden; margin: 0; padding: 0;"
ondragstart="return false;" ondrop="return false;" oncontextmenu="return false;" onmousedown="return false;">
<PARAM NAME="SCALE" VALUE="exactfit">
<embed src="&_cimage" quality="high" type="application/x-shockwave-flash" width="100%" height="100%"
allowScriptAccess="always" menu="false">
</body>
</html>
ENDTEXT
RETURN
I have spent 2 weeks on this and am now using the print to printer a rename file name to pdf
I have also tried this with hpdfprint acts the same.
Is there a save as in hmg.3.4.4
Is there a way to (SAVE AS) the same name.pdf after the picture is captured to do what the disk in the print preview does.
Thanks to all
Franco