Frequently Asked Question

How to use OpenMem method (iOS)
Last Updated a year ago

This article shows how to use OpenMem method to open pdf with data (note: the pdf will be readonly).

            //Open PDF from Mem demo
            const char *path1 = [pdfFullPath UTF8String];
            FILE *file1 = fopen(path1, "rb");
            fseek(file1, 0, SEEK_END);
            long filesize1 = ftell(file1);
            fseek(file1, 0, SEEK_SET);
            buffer = malloc((filesize1)*sizeof(char));
            fread(buffer, filesize1, 1, file1);
            fclose(file1);
            int result = [m_pdf PDFopenMem: buffer :(int)filesize1 :nil];

Loading ...