|
Iniciado por Créator1969, 24,nov. 2017 22:27 - 7 respuestas |
| |
| | | |
|
| |
Miembro registrado 7 mensajes |
|
Publicado el 24,noviembre 2017 - 22:27 |
Bonjour à toutes et tous, Je suis toujours sur WD17, et je me casse les dents sur l'API de Ghostscript v9.22 J'essaye de splitter des fichiers PDF pour en réorganiser les pages mais je sèche.
iCode, iCode1, DLLInst, GsInst sont des entier système iTemp, iNbParam sont des entier bRetour est un booléen Params est un tableau de chaînes DllPath est une chaîne="c:\Program Files (x86)\gs\gs9.22\bin\gsdll32.dll" DLLInst = ChargeDLL(DllPath) SI DLLInst = 0 ALORS Erreur(ErreurInfo()) FIN
GsInst=API("gsdll32.dll","gsapi_new_instance", &iTemp, Null) SI GsInst >= 0 ALORS
TableauSupprimeTout(Params) TableauAjoute(Params,"-dBATCH") TableauAjoute(Params,"-dNOPAUSE") TableauAjoute(Params,"-sDEVICE=pdfwrite") TableauAjoute(Params,"-o 3d.pdf") TableauAjoute(Params,"1a2.pdf")
iNbParam=TableauOccurrence(Params) iCode=API("gsdll32.dll", "gsapi_init_with_args", iTemp, iNbParam, &Params) iCode1=API("gsdll32.dll", "gsapi_exit",iTemp) FIN
API("gsdll32.dll","gsapi_delete_instance",iTemp) SI iCode = 0 ALORS bRetour=Vrai
iCode me retourne -100
Si quelqu'un à une idée ..
Bonne soirée. |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 946 mensajes Popularité : +102 (110 votes) |
|
Publicado el 27,noviembre 2017 - 12:10 |
Bonjour, Voici la traduction de l'exemple fourni sur le site de Ghostscript
hndDLL, code, minst sont des entiers système DllName est une chaîne Params est un tableau de chaînes
DllName = "C:\Program Files\gs\gs9.22\bin\gsdll64.dll"
IF NOT fFichierExiste(DllName) THEN Erreur(ChaîneConstruit("Fichier %1 inconnu ! ", DllName)) RETOUR END
hndDLL = ChargeDLL(DllName) IF hndDLL = 0 THEN Erreur(ChaîneConstruit("Chargement de la dll impossible !", DllName),ErreurInfo()) RETOUR END
code = API(DllName, "gsapi_new_instance", &minst, Null) IF code < 0 THEN DéchargeDLL(hndDLL) RETOUR ELSE Trace("gsapi_new_instance : " + minst) END
code = API(DllName, "gsapi_set_arg_encoding", minst, 1) IF code <> 0 THEN Erreur("Code = " + code) DéchargeDLL(hndDLL) RETOUR ELSE Trace("gsapi_set_arg_encoding : ok") END
TableauSupprimeTout(Params) TableauAjoute(Params, ChaîneVersUTF8("ps2pdf")) TableauAjoute(Params, ChaîneVersUTF8("-dNOPAUSE")) TableauAjoute(Params, ChaîneVersUTF8("-dBATCH")) TableauAjoute(Params, ChaîneVersUTF8("-dSAFER")) TableauAjoute(Params, ChaîneVersUTF8("-sDEVICE=pdfwrite")) TableauAjoute(Params, ChaîneVersUTF8("-sOutputFile=out.pdf")) TableauAjoute(Params, ChaîneVersUTF8("-c")) TableauAjoute(Params, ChaîneVersUTF8(".setpdfwrite")) TableauAjoute(Params, ChaîneVersUTF8("-f")) TableauAjoute(Params, ChaîneVersUTF8("C:\Program Files\gs\gs9.22\examples\alphabet.ps"))
code = API(DllName, "gsapi_init_with_args", minst, Dimension(Params), &Params) IF code <> 0 THEN Erreur("gsapi_init_with_args : " + code) ELSE Trace ("gsapi_init_with_args : ok") code = API(DllName, "gsapi_exit", minst) IF code <> 0 THEN Erreur("gsapi_exit : "+ code) ELSE Trace(("gsapi_exit : ok")) END END
DéchargeDLL(hndDLL)
je récupère bien dans le fichier <fRepEncours()>"\out.pdf" le fichier au format postscript converti |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 946 mensajes Popularité : +102 (110 votes) |
|
Publicado el 27,noviembre 2017 - 13:43 |
Pour spliter un fichier pdf de x pages dans x fichiers pdf
TableauSupprimeTout(Params) TableauAjoute(Params, ChaîneVersUTF8("-dBATCH")) TableauAjoute(Params, ChaîneVersUTF8("-dNOPAUSE")) TableauAjoute(Params, ChaîneVersUTF8("-sOutputFile=c:\temp\out%4d.pdf")) TableauAjoute(Params, ChaîneVersUTF8("-sDEVICE=pdfwrite")) TableauAjoute(Params, ChaîneVersUTF8("C:\temp\annots.pdf")) pour extraire de la page 2 à la page 2
TableauSupprimeTout(Params) TableauAjoute(Params, ChaîneVersUTF8("-dBATCH")) TableauAjoute(Params, ChaîneVersUTF8("-dNOPAUSE")) TableauAjoute(Params, ChaîneVersUTF8("-sOutputFile=c:\temp\out.pdf")) TableauAjoute(Params, ChaîneVersUTF8("-dFirstPage=2")) TableauAjoute(Params, ChaîneVersUTF8("-dLastPage=3")) TableauAjoute(Params, ChaîneVersUTF8("-sDEVICE=pdfwrite")) TableauAjoute(Params, ChaîneVersUTF8("C:\temp\annots.pdf")) |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 7 mensajes |
|
Publicado el 29,noviembre 2017 - 18:34 |
Bonjour Philippe,
Merci pour le "ChaîneVersUTF8" mon problème est réglé. (J'avais même pas regardé) |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 7 mensajes |
|
Publicado el 03,diciembre 2017 - 18:33 |
Maintenant même problème mais pour concaténer (fusionner) les fichiers
TableauAjoute(Params, ChaîneVersUTF8("-dBATCH")) TableauAjoute(Params, ChaîneVersUTF8("-dNOPAUSE")) TableauAjoute(Params, ChaîneVersUTF8("-q")) TableauAjoute(Params, ChaîneVersUTF8("-sDEVICE=pdfwrite")) TableauAjoute(Params, ChaîneVersUTF8("-sOutputFile=" + cFichierDeSortie)) TableauAjoute(Params, ChaîneVersUTF8(cListe))
Qu'est-ce que je fais de faux ??? |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 946 mensajes Popularité : +102 (110 votes) |
|
Publicado el 04,diciembre 2017 - 11:37 |
bonjour,
TableauAjoute(Params, ChaîneVersUTF8("-dBATCH")) TableauAjoute(Params, ChaîneVersUTF8("-dNOPAUSE")) TableauAjoute(Params, ChaîneVersUTF8("-q")) TableauAjoute(Params, ChaîneVersUTF8("-sDEVICE=pdfwrite")) TableauAjoute(Params, ChaîneVersUTF8("-sOutputFile=c:\temp\out.pdf")) TableauAjoute(Params, ChaîneVersUTF8("c:\temp\f1.pdf")) TableauAjoute(Params, ChaîneVersUTF8("c:\temp\f2.pdf")) |
| |
| |
| | | |
|
| | |
| |
Publicado el 18,marzo 2024 - 15:56 |
Bonjour,
Je sais que c'est 6 ans après. Mais un grand merci Philippe. On ne le dit jamais assez sur Internet. Je viens de basculer mon appli en 64bits (je suis en Windev 2024) et pas moyen de fusionner des PDF avec gsdll64.dll jusqu'à ton message.
Nicolas |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 797 mensajes Popularité : +40 (42 votes) |
|
Publicado el 20,marzo 2024 - 16:04 |
| |
| |
| | | |
|
| | | | |
| | |
|