Powerbuilder pour les completement Geeks !

Le forum (ô combien francophone) des utilisateurs de Powerbuilder.

Recherche rapide

Annonce

Certaines rubriques, dont des cours, sont uniquement visibles par les membres du forum ^^.
Dans la rubrique Liens & Références, vous avez accès à un sommaire de téléchargement, profitez-en !
Il existe maintenant un nouveau TOPIC "Votre CV en Ligne" accessible uniquement par demande.

#1 19-12-2011 10:25:47

jordel  
Membre completement Geek
Lieu: Creil
Date d'inscription: 06-05-2011
Messages: 133
Pépites: 286
Banque: 0
Site web

[RESOLU] Problème de sauvegarde d'une DW en PDF

Bonjour à tous,

Je viens d'écumer les scripts proposés sur le forum pour concevoir mon export simple en PDF... Mais voilà, mon SaveAs me renvoie toujours -1 !!!
Et je ne sais pas pourquoi !!!

Voici mon code :

Code: pb

dw_print.settransobject(sqlca)
dw_print.retrieve(il_grille)

ls_file = "C:\export.pdf"
  
li_returnpdf = dw_print.SaveAs(ls_file, PDF!, true)
  
if  li_returnpdf = 1 then
  messagebox("Enregistrement OK","Le fichier PDF a été enregistré sous : " + ls_file)
elseif li_returnpdf = -1 then
  messagebox("Enregistrement FAIL -1","Erreur lors de l'enregistrement du fichier")
else
  messagebox("Enregistrement FAIL 0","Erreur lors de l'enregistrement du fichier")
end if

Avez-vous une idée du comment du pourquoi ???

Merci d'avance

Dernière modification par jordel (20-12-2011 10:09:21)


J'ai le bras long... et au bout de ce bras, il y a Chuck Norris !

Hors ligne

 

#2 19-12-2011 10:38:48

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5121
Pépites: 97,197
Banque: 2,147,483,647

Re: [RESOLU] Problème de sauvegarde d'une DW en PDF

Bonjour,

NB :

As-tu installé Ghostscript et l'imprimante virtuelle Sybase DataWindow PS ?

En principe le code d'export est comme cela :

Code: pb

int li_ret 

dw_1.Object.DataWindow.Export.PDF.Method = Distill!
dw_1.Object.DataWindow.Printer = "Sybase DataWindow PS"
dw_1.Object.DataWindow.Export.PDF.Distill.CustomPostScript="Yes" 
li_ret = dw_1.SaveAs("custom.PDF", PDF!, true)





Using the Ghostscript distiller
In order for users to use the SaveAs method to save data as PDF with the distiller, they must first download and install Ghostscript on their computers as described in the procedure that follows.

The use of GPL Ghostscript is subject to the terms and conditions of the GNU General Public License (GPL). Users should be asked to read the GPL before installing GPL Ghostscript on their computers. A copy of the GPL is available on the GNU Project Web server .

The use of AFPL Ghostscript is subject to the terms and conditions of the Aladdin Free Public License (AFPL). Commercial distribution of AFPL Ghostscript generally requires a written commercial license. For more information, see the Ghostscript Web site .

To install Ghostscript:

Into a temporary directory on your computer, download the self-extracting executable file for the version of Ghostscript you want from one of the sites listed on the Ghostscript Web site .

See the Release Bulletin for the version of Ghostscript that was used for testing.

Run the executable file to install Ghostscript on your system.

The default installation directory is C:\Program Files\gs. You can select a different directory and/or choose to install shortcuts to the Ghostscript console and readme file.

After installing Ghostscript, you should read the readme.htm file in the doc subdirectory in the Ghostscript installation directory to find out more about using Ghostscript and distributing it with your application.

Save Rows As fails To save as PDF in the DataWindow painter, select File>Save Rows As and select PDF as the Save As type. If you do not install Ghostscript and use the default export properties, PowerBuilder displays a pop-up window notifying you that Save Rows As failed. If you install Ghostscript and then change the name of the directory where Ghostscript is installed, Save Rows As PDF fails silently.



Location of files
When you save a DataWindow object as PDF using the distill method, PowerBuilder searches in the following locations for an installation of GPL or AFPL Ghostscript:

The Windows registry
The relative path of the pbdwe120.dll file (typically Sybase\Shared\PowerBuilder)
The system PATH environment variable

If GPL or AFPL Ghostscript is installed using the Ghostscript executable file, the path is added to the Windows registry.

If the Ghostscript files are in the relative path of the pbdwe120.dll file, they must be installed in this directory structure:


dirname\pbdwe120.dlldirname\gs\gsN.NNdirname\gs\fonts

where dirname is the directory that contains the runtime DLLs and N.NN represents the release version number for Ghostscript.

You might not need to distribute all the fonts provided in the distribution. For information about fonts, see Fonts and font facilities supplied with Ghostscript .

PostScript printer drivers
If your users have installed a PostScript printer on their computers, the PostScript driver files required to create PDF files, PSCRIPT5.DLL, PS5UI.DLL, and pscript.ntf, are already installed, typically in C:\WINDOWS\system32\spool\drivers\w32x86 on Windows XP or C:\Windows\System32\DriverStore\FileRepository\ntprint.inf_1a216484\Amd64 on a 64-bit Vista system. Your users must use the version of these files that is appropriate to the operating system where the PDF file is created. They should copy the files to the dirname\drivers directory.

You must also deploy the related files that are installed in Sybase\Shared\PowerBuilder\drivers. These files can be copied to or installed on users' computers. They must be located in this directory structure:


dirname\pbdwe120.dlldirname\drivers

PostScript printer profile
Each user's computer must have a PostScript printer profile called Sybase DataWindow PS. This profile is added to your development computer automatically when you save a DataWindow's rows to a PDF file in the DataWindow painter. You can use this method to add a Sybase DataWindow PS printer on any computer where PowerBuilder is installed.

Users can also add the profile manually using the Windows Add Printer wizard in one of the following ways:

By clicking the Have Disk button on the Install Printer Software page of the wizard, browsing to the Adist5.inf file (installed with PowerBuilder in the Shared\PowerBuilder\drivers directory) or to another PostScript driver file, and on the Name Your Printer page, changing the printer name to "Sybase DataWindow PS".
By selecting a printer with PS in its name (such as "Apple Color LW 12/660 PS") from the list of printers on the Install Printer Software page of the wizard, and changing the printer name to "Sybase DataWindow PS" on the Name Your Printer page.

See the chapter on the Print Manager in the Deploying Applications and Components to .NET book if your applications print to PDF or XSL files from an IIS server.


N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#3 19-12-2011 10:51:43

seki  
0x73656B69
Award: bf
Lieu: Laquenexy & Luxembourg
Date d'inscription: 20-11-2008
Messages: 1118
Pépites: 4,296,080,204
Banque: 9,223,372,036,854,776,000
Site web

Re: [RESOLU] Problème de sauvegarde d'une DW en PDF

  (à la rubrique « Export.PDF.Method DataWindow object property » )

En fait tu as 2 méthodes pour faire du PDF :
- Distill!  (par défaut) : les données sont sauvées en postscript et distillées en pdf
- XSLFOP! : les données sont sauvées en XLS-FO et transformées en pdf

J'ai testé datawindow.export.pdf.method=XSLFOP! (en 10 secondes, avec la DW Debug machine ) et j'ai vu que ça fonctionne. Encore une fois avec PB la valeur par défaut ne fonctionne pas toujours...

Mais lis attentivement la doc, car suivant la méthode choisie, il y a des contraintes à prendre en compte pour le déploiement de l'appli (Ghostscript + driver PS pour Distill!, Apache FOP + JRE pour XSLFOP!)...

Dernière modification par seki (19-12-2011 10:52:20)


The best programs are the ones written when the programmer is supposed to be working on something else. - Melinda Varian

Mes réponses PB sur StackOverflow
http://stackoverflow.com/users/flair/317266.png

Hors ligne

 

#4 19-12-2011 11:17:58

jordel  
Membre completement Geek
Lieu: Creil
Date d'inscription: 06-05-2011
Messages: 133
Pépites: 286
Banque: 0
Site web

Re: [RESOLU] Problème de sauvegarde d'une DW en PDF

On est obligé d'installer GS !!!

Et comment ça se passe concrètement au niveau utilisateur... il suffit que ça soit installé sur le serveur ou faut l'installer sur chaque poste ???

Et quid d'une appli APPEON ???

Comment ça, je suis relou ;)


J'ai le bras long... et au bout de ce bras, il y a Chuck Norris !

Hors ligne

 

#5 19-12-2011 13:19:57

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5121
Pépites: 97,197
Banque: 2,147,483,647

Re: [RESOLU] Problème de sauvegarde d'une DW en PDF

jordel a écrit:

On est obligé d'installer GS !!!

En fait il faut juste déployer les fichiers GS dans ton dossier EXE powerbuilder :

Location of files
When you save a DataWindow object as PDF using the distill method, PowerBuilder searches in the following locations for an installation of GPL or AFPL Ghostscript:

The Windows registry
The relative path of the pbdwe120.dll file (typically Sybase\Shared\PowerBuilder)
The system PATH environment variable

If GPL or AFPL Ghostscript is installed using the Ghostscript executable file, the path is added to the Windows registry.

If the Ghostscript files are in the relative path of the pbdwe120.dll file, they must be installed in this directory structure:


dirname\pbdwe120.dlldirname\gs\gsN.NNdirname\gs\fonts

where dirname is the directory that contains the runtime DLLs and N.NN represents the release version number for Ghostscript.


N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#6 20-12-2011 10:08:12

jordel  
Membre completement Geek
Lieu: Creil
Date d'inscription: 06-05-2011
Messages: 133
Pépites: 286
Banque: 0
Site web

Re: [RESOLU] Problème de sauvegarde d'une DW en PDF

Merci pour vos réponses...
Dans le doute, j'ai installé GS sur le serveur et j'ai configuré l'imprimante nommée dans vos posts sur ce même serveur.

J'ai testé la création de pdf depuis différents postes et ça a l'air de fonctionner


J'ai le bras long... et au bout de ce bras, il y a Chuck Norris !

Hors ligne

 

Pied de page des forums

Propulsé par FluxBB 1.2.22