简体   繁体   中英

How to check whether postscript file generation completed or not?

In my code i have to generate postscript file using a word word document and finally it converts to PDF document using the postscript file(Using Acrobat Distiller).

I have one issue here while it converts word document to postscript file it is taking time to generate postscript file. Issue is with out completing the generated of the postscript file my code moves to next statement to generated PDF file using postscript file as Input parameter.
Here i want to put a check whether a postscript file generation completed and then it should move to the next statement to generated PDF.

Code to Convert Word to PostScript file

public Word.Application objWordApp = null; 
public Word.Document objWordDoc = null;

object objMissing = System.Reflection.Missing.Value;
                if (Convert.ToString(objWordApp.ActivePrinter) != AdobePDF)
                {
                    SetDefaultPrinter(AdobePDF);
                }
                objWordDoc.PrintOut(ref objMissing, ref objMissing, ref objMissing, objWordOutputPath, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing);

Code Which converts Postscript file to PDF

private PdfDistiller objPDFMaker;
public void ConvertToPDF(string psfile, string outputName)
{
  objPDFMaker.FileToPDF(psfile, outputName, "");
}

How can i check whether Postscript file generation Completed ?

The normal way to do this (when you don't have a completion event or similar mutex) is to sit in a loop and examine the file size, if it doesn't change for a period of time (up to you to decide how long) then its stable and presumably finished.

This isn't a question relevant to PostScript though.

Why do you not use the PDFMaker macros supplied with Acrobat to have Word create a PDF file directly instead of going to PostScript first ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM