?
Solved

Acrobat Distiller and C#

Posted on 2003-02-25
4
Medium Priority
?
3,765 Views
Last Modified: 2012-05-04
Hello with you all, please excuse me for my English, but it is not famous. A French version of the message is lower. I have a small problem of use with Acrobat Distiller. In a project C #, I have to create a reference to the ACRODISTXLib object. It is possible for me to use the following function: FileToPDF as well as the events OnJobDone and OnJobFail. However, I have a problem when I tests to make carry out the whole for more than one file postscript. The treatment for the first file is carried out correctly, but for the second and the following ones, it plants. Here the code which I use:

int laLongueur = leFichier.Length;
string leFichierN = leFichier.Substring(0, (laLongueur - CNDCAP(leFichier)));    
ACRODISTXLib.PdfDistiller pdf = new ACRODISTXLib.PdfDistillerClass();
pdf.OnJobDone += new _PdfEvents_OnJobDoneEventHandler(PDFOnJobDone);
pdf.OnJobFail += new _PdfEvents_OnJobFailEventHandler(PDFOnJobFail);

try {                        
pdf.FileToPDF(deOu + leFichier, versOu + leFichierN + ".pdf", " ");                    
}
catch {
EcritureErreur(leFichier, "Création du PDF1");    
File.Copy(deOu + leFichier, versNnV + leFichier, true);
File.Delete(deOu + leFichier);
}

the error which it gives in the try is the error 1410, the class already exists of acrobat. In other words, Distiller is an already instancier when one returns second once. therefore, which would be the means to launch the garbagecollector in order to make disparaitre this authority or if you have another solution.
thank you
Sebastien
---------version in french----------
Bonjour à vous tous, veuillez m'excuser pour mon anglais, mais il n'est pas fameux. Une version française du message est plus bas.

J'ai un petit problème d'utilisation avec Acrobat Distiller.
Dans un projet c#, j'ai créer une référence à l'objet ACRODISTXLib. Il m'est possible d'utiliser la fonction suivante : FileToPDF
ainsi que les événements OnJobDone et OnJobFail.

Cependant, j'ai un problème lorsque j'essais de faire exécuter le tout pour plus d'un fichier postscript.
Le traitement pour le premier fichier s'exécute correctement, mais pour le deuxième et les suivantes, il plante.
Voici le code que j'utilise :
int laLongueur = leFichier.Length;
string leFichierN = leFichier.Substring(0, (laLongueur - CNDCAP(leFichier)));

ACRODISTXLib.PdfDistiller pdf = new ACRODISTXLib.PdfDistillerClass();
pdf.OnJobDone += new _PdfEvents_OnJobDoneEventHandler(PDFOnJobDone);
pdf.OnJobFail += new _PdfEvents_OnJobFailEventHandler(PDFOnJobFail);

try {                        
pdf.FileToPDF(deOu + leFichier, versOu + leFichierN + ".pdf", " ");                    
}
catch {
EcritureErreur(leFichier, "Création du PDF1");    
File.Copy(deOu + leFichier, versNnV + leFichier, true);
File.Delete(deOu + leFichier);
}              

L'erreur qu'il donne dans le try est l'erreur 1410, La classe existe déjà. d'acrobat.
En d'autres mots, Distiller est déjà instancier lorsqu'on revient une deuxième fois.

donc, quelle serait le moyen pour lancer le garbagecollector afin de faire disparaitre cette instance ou si vous avez une autre solution.

merci
Sébastien
0
Comment
Question by:DeMortagne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Accepted Solution

by:
Nebulus_ earned 300 total points
ID: 8024467
You can use a single instance of this pdf class, created in constructor (or when you first need this) of your working class as private member.
0
 

Expert Comment

by:breezback
ID: 12961946
I added a class that has a distiller member

this class is singleton, it works fine !!

Thanks,

:)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question