PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 23 → WX - Show PDF
WX - Show PDF
Débuté par BOLLER, 20 mar. 2018 19:07 - Aucune réponse
Membre enregistré
2 864 messages
Popularité : +89 (91 votes)
Posté le 20 mars 2018 - 19:07
// Summary: <specify the procedure action>
// Syntax:
//ShowPDF (<nomchamp> is string, <nompdf> is string [, <modeSVG>])
//
// Parameters:
// nomchamp (UNICODE string): <specify the role of nomchamp>
// nompdf (UNICODE string): <specify the role of nompdf>
// modeSVG (default value=1): <specify the role of modeSVG>
// Return Value:
// None
//
// For instance:
// Indicate an example.
//
Procedure ShowPDF(nomchamp is string,nompdf is string,modeSVG=True)

strMonpdf is string=nompdf
//locaux ou distants, le HTML ouvrira toujours un pdf situé dans le dossier su script (autorisation de location JS)
//on copiera donc le fichier à ouvrir sous nomchamp.pdf avant chargement
fDelete(CompleteDir(fExeDir())+"TMPPDF_*.pdf")
nomfic is string="TMPPDF_"+DateSys()+TimeSys()+nomchamp+".pdf"
tmpPDf is string=CompleteDir(fExeDir())+""+nomfic


IF InAndroidMode() AND not InTestMode THEN
//est-ce que les ressources de gestion pdf sont bien présentes ?
IF not fFileExist(CompleteDir(fExeDir())+"viewersvg.html") OR not fFileExist(CompleteDir(fExeDir())+"viewersvg.js") THEN
fExtractResource("WD_pdfjs2.zip",fExeDir())
IF fFileExist(CompleteDir(fExeDir())+"WD_pdfjs2.zip") THEN
//decompactage de la ressource
myarch is int=zipOpen("archpdf",CompleteDir(fExeDir())+"WD_pdfjs2.zip")
IF myarch=0 THEN
zipExtractAll("archpdf",CompleteDir(fExeDir()))
zipClose("archpdf")
END
END
END
IF not fFileExist(CompleteDir(fExeDir())+"viewersvg.html") OR not fFileExist(CompleteDir(fExeDir())+"viewersvg.js") THEN
//aucun display possible, les ressources sont absentes.
//retour
END
activerjavascript(nomchamp)
END

IF Left(strMonpdf,4)="http" THEN
//1 recuperer le fichier en local avant ouverture
IF httpRequest(strMonpdf) THEN
fSaveText(tmpPDf,HTTPGetResult(httpResult))
END
ELSE
fCopyFile(strMonpdf,tmpPDf)
END

localDebug is boolean=True
IF InTestMode() THEN
//{nomchamp,indchamp}=strMonpdf
//test avec localhost
// si localDebug alors
// fCopieFichier(ComplèteRep(fRepExe())+"web\viewersvg.html","c:\wamp\www\pdfjstest\web\viewersvg.html")
// fCopieFichier(ComplèteRep(fRepExe())+"web\viewersvg.js","c:\wamp\www\pdfjstest\web\viewersvg.js")
// nomfic est une chaine="test.pdf"+datesys+heuresys
//
// fCopieFichier(tmpPDf,"c:\wamp\www\pdfjstest\web\"+nomfic)
//
// testurl est une chaine="http://localhost/pdfjstest/"+"web/viewersvg.html?url="+"./"+nomfic+"&ti="+datesys+heuresys
// //{nomchamp,indChamp}=testurl
// LanceAppliAssociée(testurl)
{nomchamp,indControl}=nompdf
ELSE

myurl is string
IF modeSVG THEN
myurl="file://"+CompleteDir(fExeDir)+"viewersvg.html?url="+"./"+nomfic+"&ti="+DateSys+TimeSys
ELSE
myurl="file://"+CompleteDir(fExeDir)+"viewer.html?url="+"./"+nomfic+"&ti="+DateSys+TimeSys
END

{nomchamp,indControl}=myurl
END


MODO DE USAR

BOTAO
strMonpdf is string ="http://www8.hp.com/h20195/v2/GetPDF.aspx/4AA6-4026ENUC.pdf"
ShowPDF("HTML1",strMonpdf,intModeSVG)



OU

BOTAO
ShellExecute(http://www8.hp.com/h20195/v2/GetPDF.aspx/4AA6-4026ENUC.pdf)


NO CASO DE VIDEO É O MESMO COMANDO

ShellExecute(LinkVideo1)



ou usando um campo do tipo html e o endereço do pdf





https://help.windev.com/en-US/…

iDestination(iPDF)
iPrintReport(RPT_MyPDFReport)
iDestination(iPDF)
// Protect the PDF against printing
// and against selection and copy/paste
// No password for opening the PDF file
// Password for modifying the protection settings
iParameterPDF(iProtectionPrinting, iProtectionSelection, "", "Protection")
// Print the report
iPrintReport(RPT_MyPDFReport)


ou

// Create the PDF file
iDestination(iPDF, "C:\Temp\MyPDF.PDF")
// Print code
iCreateFont(1, 16, iBold, iRoman)
//Call to procedures used to print the content
PrintTitle()
PrintText()
// End of print and close the created PDF file
iEndPrinting()


// Protect the PDF against printing
// and against selection and copy/paste
// No password for opening the PDF file
// Password for modifying the protection settings
iParameterPDF(iProtectionPrinting, iProtectionSelection, "", "Protection")
// Create the PDF file
iDestination(iPDF, "C:\Temp\MyPDF.PDF")
// Print code
iCreateFont(1, 16, iBold, iRoman)
//Call to procedures used to print the content
PrintTitle()
PrintText()
// End of print and close the created PDF file
iEndPrinting()



https://help.windev.com/en-US/…

BOTAO
ShellExecute(http://www8.hp.com/h20195/v2/GetPDF.aspx/4AA6-4026ENUC.pdf)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Message modifié, 20 mars 2018 - 19:19