Merging two PGC files

Question
How do I merge data from 2 PGC files into one file?

Answer
There is no separate “Merge” method in the PC SDK. The PgcSplitterExClass in Anoto.Util module can be used to merge 2 (or more) PGC files into one.

Overview
Example:

<span class="wysiwyg-font-size-small">//declare your PGC splitter/joiner class </span><br><span class="wysiwyg-font-size-small"> Anoto.Util.PgcSplitterExClass splitter = new Anoto.Util.PgcSplitterExClass(); </span><br> <br><span class="wysiwyg-font-size-small"> //read the pgc files from disk if already saved </span><br><span class="wysiwyg-font-size-small"> Object page1_data = fileReader.Read(..\\first_file.pgc"); </span><br><span class="wysiwyg-font-size-small"> Object page2_data = fileReader.Read(..\\second_file.pgc"); </span><br> <br><span class="wysiwyg-font-size-small"> //load first file in splitter… </span><br><span class="wysiwyg-font-size-small"> splitter.Insert(page1_data); </span><br> <br><span class="wysiwyg-font-size-small"> //..then the other, save the returned addresses </span><br><span class="wysiwyg-font-size-small"> Object addresses = splitter.Insert(page2_data); </span><br> <br><span class="wysiwyg-font-size-small"> //extract merged data </span><br><span class="wysiwyg-font-size-small"> Object mergeData = splitter.Extract(addresses); </span><br> <br><span class="wysiwyg-font-size-small"> //..and save it to a new file </span><br><span class="wysiwyg-font-size-small"> fileReader.Write(…\\mergedData.pgc", mergeData); </span><br> <br><span class="wysiwyg-font-size-small"> //Don’t forget to call renderer for all pages in your pgc files </span><br><span class="wysiwyg-font-size-small"> //otherwise you wont see the strokes from all merged pages. </span><br> <br><span class="wysiwyg-font-size-small"> foreach (Anoto.Common.Page page in request.Pages) </span><br><span class="wysiwyg-font-size-small"> { </span><br><span class="wysiwyg-font-size-small"> renderer.Draw(myImage, page.PenStrokes); </span><br><span class="wysiwyg-font-size-small"> }</span>

Note: PGC files from different pens cannot be merged!

Applies To
PC SDK

Was this article useful? Thanks for the feedback There was a problem submitting your feedback. Please try again later.