Re: [Doc2pdf-devel] doc2pdf problems
Status: Beta
Brought to you by:
mpeterson
From: Norbert W. <nw...@sb...> - 2002-01-15 09:09:54
|
Hallo Matt, your description helped me to find the reason for doc2pdf's timing out: The ms wordviewer window has another title than what doc2pdf expects. It seems, that the title always is Microsoft Word Viewer - 1attachment.doc with the name of the attached file. I can supply a screenshot, if that helps. Regards Norbert Matt Peterson schrieb: > > Norbert, > > What happens if the same email is sent to do...@ho...? If > do...@ho... works, there is definately something different about your > installation. > > Please tell me what settings (exclude passwords) you have set for doc2pdf. > The settings can be viewed by clicking the setup button. > > The most interesting thing is that the .ps files are created, yet the print > dialogs are not being closed properly. Someone sent me an email earlier that > mentioned something about a similar problem on foriegn versions of Windows 98 > regardless of the language of the viewer. When converting .ppt or .xls > documents, may be that some of the the viewers use the MFC print dialogs > which might not display "Print To File". The XlsToPs() and PptToPs() code do > look for a dialog entitled "Print To File". Because of the way that the > WordViewer works, the DocToPs() code does not look for a "Print To File" > window. > > Since you seem to be seeing a failure when converting .doc files, there must > be something else wrong... It will be difficult to debug this via email, so > I will give you all the information I have so that you can debug it yourself. > > .doc files are converted to .ps by the DocToPs() function in > doc2pdf_convert.cpp. As you read in the web documentation, this function > invokes the MS Word Viewer then feeds it keystrokes to automate what would > otherwise be the manual procedure of printing the document to a file. The > code make the following assumptions: > > 1 - You have already set up a "print to file" PostScript printer as the > *default* printer for the machine running doc2pdf. Again, this printer > *must be* the *default* printer for the machine. Follow the installation > guide for specific instructions on how this is done. > > 2 - You have to have the MS Word Viewer installed and file associations have > to be set up so that the MS Word Viewer is set up to be the program > that handle .doc files. > > The following steps are taken when converting documents: > > 1 - When invoked, DocToPs() opens the .doc attachment with a call to > ShellExecute() which on a properly configured machine uses MS Word > Viewer to open the .doc file. > > 2 - DocToPs() then waits for a window to appear that has the following title: > "Microsoft Word Viewer - mydocument.doc". The text for this title > (other than the name of the document which is extracted from the email) > is configurable at compile time by modification of #defines at the > top of doc2pdf_convert.cpp(). If the "Microsoft Word Viewer - > mydocument.doc" does not appear then DocToPs() will timeout and return > an error > > 3 - When the "Microsoft Word Viewer - mydocument.doc" window appears, > DocToPs() sends the following keystrokes to the viewer (you can manually > enter these keystrokes to see if the behavior of your installation > matches the behavior DocToPs() expects: > > ctrl-p <-- brings up the print dialog > > enter <-- select print to the default printer and displays the "Print > To File" dialog. > > "c:\windows\temp\mydocument.ps" <-- The name of the file to print to. > Note: DocToPs() does not check for > the existance of the "Print To File" > dialog before sending this string. > > enter <-- like clicking the OK button > > 4 - After sending these keystokes to the MS Word Viewer, no other MS Word > Viewer windows should exist other than the original window entitled > "Microsoft Word Viewer - mydocument.doc". If additional printer specific > or Microsoft Word Viewer Windows exist then you will have problems. > > 5 - There is one exception to item #6 above... Sometimes (depending on the > printer) an single error dialog will be displayed that notifies the > user that they are attempting to print a document that exceeds the page > boundaries for the selected printer. This dialog has a window title of > "Microsoft Word Viewer 97". It turns out that when writing a .ps file > page boundaries can be ignored so DocToPs() simply clears this dialog > by sending an "enter" keystroke which is like clicking OK. > > 6 - Documents take differing amounts of time to print to file (depending on > the length and complexity) therefore, DocToPs() simply waits for the > "c:\windows\temp\mydocument.ps" file to become writeable. This is how > DocToPs() knows when the document is finished printing. The wait loop > is simple: > > while(not_timed_out) > { > Look for window entitled "Microsoft Word Viewer 97" and clear > it if it exists. > > Check "c:\windows\temp\mydocument.ps" and break if it is > writeable. > } > > 7 - If the above loop times out (as opposed to breaking prematurely due > to the writeablilty of "c:\windows\temp\mydocument.ps" then DocToPs() > errors out. Otherwise the conversion was considered a success. In > both cases the MS Word Viewer should be closed and Doc2pdf will either > proceed to convert the .ps to .pdf via a call to PsToPdf() or it will > mark the email as not convertable and proceed to the next email. > > I hope this information is useful. My guess is that everything is working on > your installation up until step 4. Then I suspect that you are encountering > unexpected error or warning dialogs that DocToPs() can not handle. If this > is the case, it is probably because of your selection of print driver for the > default printer or perhaps because your Win98 installation is slightly > different from mine. > > Thanks for reporting this problem. Please let me know how things go. I'll > be happy to make any changes to Doc2pdf code or documentation that will help > others avoid the same problem. > > Regards, > > Matt > > > On Monday 14 January 2002 06:32 am, Norbert Wegener wrote: > > Hello, > > I just installed doc2pdf-0.4 on a win98 machine. I can start up doc2pdf. > > When mail arrives, doc2pdf fetches the mail and opens the attachment in > > wordview. > > After that two windows are opened for a very short time and that's it > > > > :-( > > > > Wordviewer -english version- stays up. Some minutes later doc2pdf seems > > to get an timeout, closes wordview and I receive an error mail. > > What might be wrong with my installation? Anyone any ideas? > > > > Regards > > Norbert > > > > Norbert Wegener also wrote: > > > > Hello, > > I just installed doc2pdf-0.4 on a win98 machine. I can start up doc2pdf. > > When mail arrives, doc2pdf fetches the mail and opens the attachment in > > wordview. > > After that two windows are opened for a very short time and that's it > > :-( > > Wordviewer -english version- stays up. Some minutes later doc2pdf seems > > to get an timeout, closes wordview and I receive an error mail. > > What might be wrong with my installation? Anyone any ideas? > > > > Regards > > Norbert > > > > _______________________________________________ -- Norbert Wegener Fax : (49) 201 2661 377 Mailfax: (49) 201 816399018 SBS Essen Phone:(49) 201 2661 379 Germany Mail: nor...@sb... http://relax.sbs.de (intranet) |