Error message: No active document!

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Error message: No active document!

Postby Bengt » Fri Jul 14, 2017 8:42 am

If a VPE preview is open and the program tries to open another preview based on the same .vpe file, the error message No active document is shown.

The code below generate this error

Send OpenDocFile PrintFile // Printfile can be c:\MInerva\Order123.vpe
Send DoVpeSetUpPrinter sPRSfile 1 // Error when this line is executed . sPRSfile can be c:\Minerva\Order.prs


I normally use a local map c:\Minerva for storing temporary .vpe files and user specific settings, but when Windows terminal server is used, all users share the same C:\Minerva, and then the problem turns up especially often. Then it is impossible for two users print the same order simultaneously.

Another common situation is when a preview is hidden behind other windows and the same user by accident tries to print the same document a second time without closing the first preview. After the No active document error is shown, it is shown again a couple of times so the user have to click OK many times to continue.

It is curious that the error is generated by VpeSetUpPrinter, not with the previous line.

How is it possible to avoid this error? Is it possible to check it a preview on that specific file is already open?

Bengt
Bengt
 
Posts: 89
Joined: Fri Jan 27, 2006 5:29 pm

Re: Error message: No active document!

Postby IDEAL Software Support » Fri Jul 14, 2017 9:48 am

Please see the documentation for VpeOpenDocFile(). When opening a native VPE document file using this method, the file is kept pemanently open, because only one page (the current page) is held in memory. All other pages are kept on disk. Even in this mode, it is possible to add new objects to existing pages, and - only for the Professional Edition and higher: to insert and remove whole pages. Therefore no other process may open the file for modifications at the same time.

If you only wish to read the file, use the flag VPE_DOCFILE_READONLY. This way multiple processes can open the file at the same time. But only, if no other process opened it in read/write mode.
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 12 guests

cron