Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Acrobat Distiller and C#

Posted on 2003-02-25
4
Medium Priority
?
3,824 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
2 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

581 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