Page 1 of 1

Word to PDF conversion speed

Posted: Fri Dec 15, 2006 9:15 pm
by dmjung
I'm using OfficeInside to convert Word documents to PDF. This is currently taking about 10 seconds per document which isn't too bad except when you have to do several hundred (or over 1,000 like I'm waiting on now.)

Any ideas/tips on how to speed the conversion process up. I'm sure most of the time is spent fooling around with MS Word and outside our control, but thought I'd ask.


Posted: Sat Dec 16, 2006 7:31 am
by John - Tracker Supp
Hi David,

Most likely this is going to be a question better asked of Capesoft - rather than us - although we will of course take a look.

I suspect much of the delay is caused opening the file in Word.

Posted: Sat Dec 16, 2006 2:47 pm
by Tracker - Clarion Support
Hi David!

I concur with John.

Our PDF-XChange Driver PDF generation is usually pretty fast.

Keep in mind that Office Inside is a COM interface to MS-Word and is bound by what Word can do and how fast it can do it, and Word is not a speedy product.


Posted: Wed Dec 20, 2006 3:46 pm
by dmjung
Tracker - Clarion Support wrote:...and Word is not a speedy product.
Why, whatever would make you think that? :)

In a similar situation using OI for Word mailmerge, I ended up making a mailmerge "service" thread so that the init of Word was done once at my program startup. Similarly, Sean thinks reorganizing this code into a single process that only does the init once, converts all the docs and then kills the word object would be cleanest.


Posted: Wed Dec 20, 2006 6:10 pm
by John - Tracker Supp
Hi David,

Yes - initialising Word at startup and processing all files before closing does seem like a good work around - though possibly a little resource hungry - hope all goes well :)

Posted: Fri Dec 22, 2006 9:13 pm
by dmjung
OK, I've merged all the code into a single procedure and it almost works. :)

I can't seem to get rid of a Save As file dialogue for the PDF. Attached is the generated code for the procedure.

ABC report template, no report, uses a queue as the source.

At procedure init, I load up the queue with a DIRECTORY() command, then for each queue entry, I do some fiddling around and eventually call a Doc2Pdf routine. This routine's code is cribbed from a hidden button that generates the pdfxchange code for me.

Any ideas would be appreciated...


Posted: Sun Dec 24, 2006 2:22 am
by Tracker - Clarion Support
Hi David!

I don't see anything wrong in detail with what you have sent us. However I am concerned that what you are doing may be causing a synchronization issue with the PDF-XChange Driver, and therefore the registry codes may not being set and the driver is using default values, one of which is to call the Save As file dialogue.

You are running a loop using part of the PDFXCDriver30 class, with the Init and Kill for the class outside the loop. We never intended for the class to be used in this fashion, and I cannot say for certain that this will or will not work as intended.

But unless you take care to use EVENT:PDF3DRV_DocSaved to control the actual processing you may be creating the conditions for sync failure. Remember, there is a time delay between the time that Word finishes prinitng to the spooler, and the time that the PDF file generation is complete. OI knows nothing of this, nor should it.

Your loop has to read a queue record, begin the print process, WAIT for EVENT:PDF3DRV_DocSaved to signal that the PDF file has been created, and THEN proceed to save the output.


Posted: Sun Dec 24, 2006 1:11 pm
by Tracker - Clarion Support
Hi David!

One other thing - please check our demo on the PC showing the problem and see if that is functioning properly, with no the Save As file dialogue and no demo watermarks.

Thanks and Happy Holidays!

Posted: Tue Jan 02, 2007 4:06 pm
by dmjung
Back now...I'll chew through your responses this week and see what shakes out. Thanks.

Posted: Tue Jan 02, 2007 5:59 pm
by John - Tracker Supp
ok - thanks David.

Posted: Fri Jan 05, 2007 10:20 am
by marisoft
Hi David,

I am strugling with a similar job (see this post: ... php?t=2437).

I have tried using the Office Inside demo-program but are stuck when converting multiple docs.

If you get a solution I would very much like to hear about it.


Posted: Fri Jan 05, 2007 10:30 am
by John - Tracker Supp
Hi Poul/David,

Is it possible one of you could provide a complete small sample app that demonstrates the issues you are experiencing with some sample .doc files and I will have this checked here and see if we can get to the bottom of this once and for all ?

The more we get from you - the better, in terms of a ready to run app (of course we do need source) .

please also confirm specifically the version of Clarion and Windows on which you are testing when you send the app.

If its too big or private to post here - you can of course send to me direct (zipped) :

Many thanks

Posted: Fri Jan 05, 2007 1:21 pm
by marisoft

Here is a simple app.
For some reason I could not remove the FM3 3rd-party template. I hope this is no problem.


Posted: Fri Jan 05, 2007 5:21 pm
by John - Tracker Supp
Thanks Poul,

received by email.

Posted: Sun Jan 07, 2007 8:37 pm
by Tracker - Clarion Support
Hi Poul, David!

I dug through the class files and did find a bug with some old code that was suppressing the messages and hence "jamming" the app. That's been fixed.

Poul: I added ONE line of code in your PrintDocPdfA procedure:

Code: Select all

  if g:BatchRun = 1
    0{PROP:Hide} = True
    post(event:accepted, ?ButtonDanPdf )
It hides the procedure window when doing a batch run.

I'll email the zip files to you both and to John V; I cannot seem to upload the attachment.

Posted: Mon Jan 08, 2007 7:29 am
by marisoft
Hi Craig,

Fantastic - it now works as expected.


Posted: Mon Jan 08, 2007 9:30 am
by John - Tracker Supp
Excellent - thanks Poul ;)