Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VC++ or VB to VFP Code
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01078483
Message ID:
01078650
Vues:
9
Thank you Anatoliy, I have. Here is my lastest trial:
LPARAMETERS firstform, nextform, ipages

*firstform and nextform are already fullpath, ipages is integer
*Redundant and not very logical structured code in testing below but
*it is only test code right now

LOCAL lResult, q_Acord
lResult = .F.

*--Merge data from vfp form fields into the pdf document form fields
DO acordfil WITH nextform, nSystemID, nPolicyID, nFormID

xPDF = nextform
=SYS(1104)
xPDF = UPPER(hdir+SYS(2015)+SYS(3)+".PDF")
newfile = UPPER(hdir+SYS(2015)+SYS(3)+".PDF")
IF FILE(FULLPATH(nextform))
	PRIVATE lcprtno
	lcprtno = ALLTRIM(STR(ipages))
	lcudf = SET('UDFPARMS')
	SET UDFPARMS TO VALUE  && this is necessary for the extract
	SET CLASSLIB TO ATIPDF.VCX ADDITIVE
	ofrmPDFTool = NEWOBJECT('Form')  && Create a Form
	ofrmPDFTool.ADDOBJECT("oPDFTool", "PDFToolKit")
	IF ipages = 1	&& extract only page 1 to merge
		WITH ofrmPDFTool.oPDFTool
			.LoadFromFile(FULLPATH(nextform))
			.ExtractPagesTo(FULLPATH(xPDF),"1")
		ENDWITH
		IF FILE(FULLPATH(xPDF)) .AND. FILE(FULLPATH(nextform))
			COPY FILE (FULLPATH(xPDF)) TO (FULLPATH(nextform))
		ENDIF
	ENDIF
	* Merge Acord Forms
	SET UDFPARMS TO REFERENCE  && for the mergedocs process
	IF FILE(FULLPATH(nextform))
		IF nextform <> firstform	&& not the same pdf, merge them
			IF FILE(FULLPATH(firstform))
				DIMENSION doclist(2)
				doclist(1) = FULLPATH(firstform)
				doclist(2) = FULLPATH(nextform)

                                *--Tried with/without next line and also as ,0
				COMARRAY(ofrmPDFTool,10)

				WITH ofrmPDFTool.oPDFTool
					.MergeDocs(@doclist)
					.SaveToFile(newfile)
				ENDWITH
				IF FILE(FULLPATH(newfile))
					COPY FILE (FULLPATH(newfile)) TO (FULLPATH(firstform))
				ENDIF
			ENDIF
		ENDIF
	ENDIF
	IF TYPE('ofrmPDFTool') = "O" .AND. !ISNULL(ofrmPDFTool)
		ofrmPDFTool.RELEASE()
	ENDIF
	ofrmPDFTool = NULL
	RELEASE ofrmPDFTool
	RELEASE CLASSLIB ATIPDF
	SET UDFPARMS TO &lcudf
ENDIF
IF FILE(xPDF)
	DELETE FILE (xPDF)
ENDIF
IF FILE(FULLPATH(nextform))
   lResult = .T.
ELSE
   lResult = .F.
ENDIF
RETURN lResult
Howerver, according to my last response from Gnostice via email (they are in India so the communication is very slow and very frustrating), they are building a new ocx for us to test on Monday because they could not get it to work from VFP either. They told me that they will create an additional method to use in lieu of mergedocs for foxpro. When we purchased the toolkit, they knew we were using it from VFP. We'll see...
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform