Sample code showing how to use PDFNet SDK from pure C (not via C++)

Q: Could you provide a simple sample in C (not C++) that does
something like open a PDF and save it? I am struggling to see how to
get the equivalent of PDDocOpen(filename) from C working with your
(although from C++ it is easy).
A: I didn't find any ready-to-use C code snippet, however direct
translation/lookup from C++ sample gives the following calls:

#include <C/PDF/TRN_PDFNet.h>
#include <C/PDF/TRN_PDFDoc.h>
#include <stdio.h>

// Open a PDF and print out its page count
int main(int argc, char *argv[])
        int ret = 0;
        TRN_Exception ex=TRN_PDFNetInitialize(0);

        TRN_PDFDoc doc;
        ex=TRN_PDFDocCreateFromFilePath("c:\\my.pdf", &doc);
        if(ex!=0) { assert(false); return 1; }

        int page_count = 0;
        ex=TRN_PDFDocGetPageCount(doc, &page_count);

        printf("%d\n", page_count);

        if(ex!=0) { assert(false); return 1; }

        return 0;