How to append pages to another doc

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

How to append pages to another doc

Postby Brent Rose » Sat Dec 27, 2014 9:07 am

I am wanting to save selected pages from one VPE doc to another (new) VPE doc - eg to "C:\Temp\Merged.vpe" (VPE Ver 7)

With the source doc open, I call:

Code: Select all
      WriteDocPageRange("C:\Temp\Merged.vpe", 1, 3);
      WriteDocPageRange("C:\Temp\Merged.vpe", 7, 7);


If C:\Temp\Merged.vpe does not yet exist, the first write successfully creates the new doc with pages 1 to 3 as expected. However, the second write does NOT append page 7.

Once C:\Temp\Merged.vpe exists, it seems no further pages can be appended.

What am I missing here? Thanks.
Brent Rose
 
Posts: 50
Joined: Wed Mar 21, 2012 8:13 pm

Re: How to append pages to another doc

Postby IDEAL Software Support » Mon Dec 29, 2014 12:08 pm

We tested the exact same case, i.e. writing pages 1-3 and append page 7, and it works as it should.

Make sure the VPE document file is not open anywhere else, which will cause a write lock on the file, e.g. if it is open in VpeView, or when it is opened by VPE using the swap file name (DLL: VpeOpenDocFile()).
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Re: How to append pages to another doc

Postby Brent Rose » Wed Dec 31, 2014 7:32 am

Thanks - that was the problem. The source doc was open in preview to allow the user to select the pages for the new doc...
Brent Rose
 
Posts: 50
Joined: Wed Mar 21, 2012 8:13 pm

Re: How to append pages to another doc

Postby Brent Rose » Sat Jan 03, 2015 1:42 am

Actually, the problem is apparently because I set "DocFileReadOnly := True;" with the source report to avoid having exclusive access to the file. Setting it "False" resolved the problem. ie I could extract the multiple pages I wanted into a new doc without having to close the source doc in preview.

Previously, by closing the preview and re-opening the source doc, I unknowingly restored the default "DocFileReadOnly := False;" and so it worked.
Brent Rose
 
Posts: 50
Joined: Wed Mar 21, 2012 8:13 pm

Re: How to append pages to another doc

Postby IDEAL Software Support » Tue Jan 06, 2015 10:50 am

Thank you for the updated information. We can reproduce the problem and agree that this is a logical error. If you can initially create the external document file using WriteDoc(), it should also be possible to append pages later to the external file from the current document. Especially because the manual says that the property DocFileReadOnly controls how a document is opened for reading, when using ReadDoc(). The intention is to allow multiple clients to open the same file at the same time with read-only-access, if no process is writing to it.

The next service release will fix this issue.
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 11 guests

cron