| 50 | } |
| 51 | |
| 52 | bool PdfiumComic::openComic(const QString &path) |
| 53 | { |
| 54 | pdfFile.setFileName(path); |
| 55 | |
| 56 | if (pdfFile.open(QIODevice::ReadOnly) == false) { |
| 57 | qDebug() << "unable to open file : " << path; |
| 58 | return false; |
| 59 | } |
| 60 | |
| 61 | fileAccess.m_FileLen = pdfFile.size(); |
| 62 | fileAccess.m_GetBlock = pdfRead; |
| 63 | fileAccess.m_Param = &pdfFile; |
| 64 | |
| 65 | QMutexLocker lock(&pdfmutex); |
| 66 | doc = FPDF_LoadCustomDocument(&fileAccess, NULL); |
| 67 | if (doc) { |
| 68 | return true; |
| 69 | } else { |
| 70 | qDebug() << FPDF_GetLastError(); |
| 71 | return false; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | void PdfiumComic::closeComic() |
| 76 | { |