Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:23:47

0001 //========================================================================
0002 //
0003 // JSInfo.h
0004 //
0005 // This file is licensed under the GPLv2 or later
0006 //
0007 // Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
0008 // Copyright (C) 2020, 2021 Albert Astals Cid <aacid@kde.org>
0009 // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
0010 // Copyright (C) 2020 Oliver Sander <oliver.sander@tu-dresden.de>
0011 // Copyright (C) 2020 Nelson Benítez León <nbenitezl@gmail.com>
0012 //
0013 // To see a description of the changes please see the Changelog file that
0014 // came with your tarball or type make ChangeLog if you are building from git
0015 //
0016 //========================================================================
0017 
0018 #ifndef JS_INFO_H
0019 #define JS_INFO_H
0020 
0021 #include <cstdio>
0022 #include "Object.h"
0023 #include "PDFDoc.h"
0024 #include "poppler_private_export.h"
0025 #include "Link.h"
0026 #include "UnicodeMap.h"
0027 
0028 class PDFDoc;
0029 
0030 class POPPLER_PRIVATE_EXPORT JSInfo
0031 {
0032 public:
0033     // Constructor.
0034     explicit JSInfo(PDFDoc *doc, int firstPage = 0);
0035 
0036     // Destructor.
0037     ~JSInfo();
0038 
0039     // scan for JS in the PDF
0040     void scanJS(int nPages);
0041 
0042     // scan and print JS in the PDF
0043     void scanJS(int nPages, FILE *fout, const UnicodeMap *uMap);
0044 
0045     // scan but exit after finding first JS in the PDF
0046     void scanJS(int nPages, bool stopOnFirstJS);
0047 
0048     // return true if PDF contains JavaScript
0049     bool containsJS();
0050 
0051 private:
0052     PDFDoc *doc;
0053     int currentPage;
0054     bool hasJS;
0055     bool print;
0056     FILE *file;
0057     const UnicodeMap *uniMap;
0058     bool onlyFirstJS; /* stop scanning after finding first JS */
0059 
0060     void scan(int nPages);
0061     void scanLinkAction(LinkAction *link, const char *action);
0062     void printJS(const GooString *js);
0063 };
0064 
0065 #endif