7¤0ìû¹#?°Ò¨0Ã0Ã0Ã`«N­[¢™ì&8±¶i“ŒÆ€ZÏ`ûø‘ŽVô¿±¾ÐQkB‘È^j|wD2B '¸ó Œ‡ÃápD$éºú �“&“�Ž‘ÒHÄ0
‚†a†aBŒ1…È’™  ôR…9È2                   pedef std::vector<StructElement *> ElemPtrArray;

    // Structure for items in /ParentTree, it keeps a mapping of
    // object references and pointers to StructElement objects.
    struct Parent
    {
        Ref ref = Ref::INVALID();
        StructElement *element = nullptr;
    };

    PDFDoc *doc;
    Object roleMap;
    Object classMap;
    ElemPtrArray elements;
    std::map<int, std::vector<Parent>> parentTree;
    std::multimap<Ref, Parent *> refToParentMap;

    void parse(Dict *rootDict);
    void pamples; // the samples
    int nSamples; // size of the samples array
    double *sBuf; // buffer for the transform function
    mutable double cacheIn[funcMaxInputs];
    mutable double cacheOut[funcMaxOutputs];
    bool ok;
};

//------------------------------------------------------------------------
// ExponentialFunction
//------------------------------------------------------------------------

class ExponentialFunction : public Function
{
    class PrivateTag
    {
    };

public:
    ExponentialFunction(Object *funcObj, Dic   int m, n; // size of input and output tuples
    double // min and max values for function domain
            domain[funcMaxInputs][2];
    double // min and max values for function range
            range[funcMaxOutputs][2];
    bool hasRange; // set if range is defined
};

//------------------------------------------------------------------------
// IdentityFunction
//------------------------------------------------------------------------

class IdentityFunction : public Function
{
public:
    IdentityFunction();
    ~Identit> open(int fdA);
#endif

#ifdef _WIN32
    static std::unique_ptr<GooFile> open(const wchar_t *fileName);

    ~GooFile() { CloseHandle(handle); }

    // Asuming than on windows you can't change files that are already open
    bool modificationTimeChangedSinceOpen() const;

private:
    GooFile(HANDLE handleA);
    HANDLE handle;
    struct _FILETIME modifiedTimeOnOpen;
#else
    ~GooFile() { close(fd); }

    bool modificationTimeChangedSinceOpen() const;

private:
    explicit GooFile(int fdA);
    int fd;
    struct timespec morsion information, and information about features
 * enabled at compile time. This is primarily useful in configure checks
 * for builds that have a configure script, or for allowing code to optionally
 * depend but not require a specific poppler version.
 */

/**
 * POPPLER_HAS_CAIRO:
 *
 * Defined if poppler was compiled with cairo support.
 */
#define POPPLER_HAS_CAIRO 1

/**
 * POPPLER_MAJOR_VERSION:
 *
 * The major version number of the poppler header files (e.g. in poppler version
 * 0.1.2 this is 0.)
 *
 * Since: 0.12
 */
#dpler_certificate_info_get_issuance_time(const PopplerCertificateInfo *certificate_info);
POPPLER_PUBLIC
GDateTime *poppler_certificate_info_get_expiration_time(const PopplerCertificateInfo *certificate_info);
POPPLER_PUBLIC
PopplerCertificateInfo *poppler_get_certificate_info_by_id(const char *id);
POPPLER_PUBLIC
GList *poppler_get_available_signing_certificates(void);

/* NSS */
POPPLER_PUBLIC
void poppler_set_nss_dir(const char *path);
POPPLER_PUBLIC
char *poppler_get_nss_dir(void);
typedef char *(*PopplerNssPasswordFunc)(const gd poppler_form_field_choice_unselect_all(PopplerFormField *field);
POPPLER_PUBLIC
void poppler_form_field_choice_toggle_item(PopplerFormField *field, gint index);
POPPLER_PUBLIC
void poppler_form_field_choice_set_text(PopplerFormField *field, const gchar *text);
POPPLER_PUBLIC
gchar *poppler_form_field_choice_get_text(PopplerFormField *field);
POPPLER_PUBLIC
PopplerSignatureInfo *poppler_form_field_signature_validate_sync(PopplerFormField *field, PopplerSignatureValidationFlags flags, GCancellable *cancellable, GError **error);
POPR_FORM_BUTTON_RADIO
} PopplerFormButtonType;

typedef enum
{
    POPPLER_FORM_TEXT_NORMAL,
    POPPLER_FORM_TEXT_MULTILINE,
    POPPLER_FORM_TEXT_FILE_SELECT
} PopplerFormTextType;

typedef enum
{
    POPPLER_FORM_CHOICE_COMBO,
    POPPLER_FORM_CHOICE_LIST
} PopplerFormChoiceType;

/**
 * PopplerAdditionalActionType:
 * @POPPLER_ADDITIONAL_ACTION_FIELD_MODIFIED: The action to be performed when the user modifies the field.
 * @POPPLER_ADDITIONAL_ACTION_FORMAT_FIELD: The action to be performed before the field is formatted to
 * dispget_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_RUBY_POSITION (poppler_structure_ruby_position_get_type ())
POPPLER_PUBLIC
GType poppler_structure_glyph_orientation_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_GLYPH_ORIENTATION (poppler_structure_glyph_orientation_get_type ())
POPPLER_PUBLIC
GType poppler_structure_list_numbering_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_LIST_NUMBERING (poppler_structure_list_numbering_get_type ())
POPPLER_PUBLIC
GType poppler_structure_form_role_get_e POPPLER_TYPE_STRUCTURE_PLACEMENT (poppler_structure_placement_get_type ())
POPPLER_PUBLIC
GType poppler_structure_writing_mode_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_WRITING_MODE (poppler_structure_writing_mode_get_type ())
POPPLER_PUBLIC
GType poppler_structure_border_style_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_BORDER_STYLE (poppler_structure_border_style_get_type ())
POPPLER_PUBLIC
GType poppler_structure_text_align_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_TEXT_ALle y1, GfxColor *color1, double x2, double y2, GfxColor *color2, int nComps, int depth, GfxState::ReusablePathIterator *path);
    void gouraudFillTriangle(double x0, double y0, double color0, double x1, double y1, double color1, double x2, double y2, double color2, double refineColorThreshold, int depth, GfxGouraudTriangleShading *shading,
                             GfxState::ReusablePathIterator *path);
    void doPatchMeshShFill(GfxPatchMeshShading *shading);
    void fillPatch(const GfxPatch *patch, int colorComps, int patchCoid opSetMiterLimit(Object args[], int numArgs);
    void opSetLineWidth(Object args[], int numArgs);
    void opSetExtGState(Object args[], int numArgs);
    void doSoftMask(Object *str, bool alpha, GfxColorSpace *blendingColorSpace, bool isolated, bool knockout, Function *transferFunc, GfxColor *backdropColor);
    void opSetRenderingIntent(Object args[], int numArgs);

    // color operators
    void opSetFillGray(Object args[], int numArgs);
    void opSetStrokeGray(Object args[], int numArgs);
    void opSetFillCMYKColor(Objec----------

enum GfxClipType
{
    clipNone,
    clipNormal,
    clipEO
};

enum TchkType
{
    tchkBool, // boolean
    tchkInt, // integer
    tchkNum, // number (integer or real)
    tchkString, // string
    tchkName, // name
    tchkArray, // array
    tchkProps, // properties (dictionary or name)
    tchkSCN, // scn/SCN args (number of name)
    tchkNone // used to avoid empty initializer lists
};

#define maxArgs 33

struct Operator
{
    char name[4];
    int numArgs;
    TchkType tchk[maxArgs];
    void (Gfx::*func)(ObjectDeviceGray,
    DeviceRGB,
    DeviceCMYK
};

/**
 * This class is used only to load Image XObjects into stamp annotations. It takes in
 * the image parameters in its constructors and creates a new Image XObject that gets
 * added to the XRef table, so that the annotations that would like to use it be able
 * to get its ref number.
 *
 * To have transparency in the image, you should first try to create the soft
 * mask of the image, by creating a AnnotStampImageHelper object giving it the soft
 * image data normally. You would thenx1f20, 0x1f21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1fc6, 0x1fc3, 0, 0 },
    { 0x1f76, 0x03af, 0, 0, 0x1fd1, 0x1fd0, 0, 0x03ca, 0, 0, 0, 0, 0, 0, 0x1f30, 0x1f31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1fd6, 0, 0, 0 },
    { 0x1f78, 0x03cc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1f40, 0x1f41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1fe4, 0x1fe5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0x1f7a, 0x03cd, 0, 0, 0x1fe1, 0x1fe0, 0, 0x03cb, 0, 0, 0, 0, 0, 0, 0x1f50, 0x1f51, 0,x0159, 0x0211, 0x0213, 0, 0, 0, 0x1e5b, 0, 0, 0, 0x0157, 0, 0, 0, 0, 0x1e5f, 0, 0, 0, 0 },
    { 0, 0x015b, 0x015d, 0, 0, 0, 0x1e61, 0, 0, 0, 0, 0x0161, 0, 0, 0, 0, 0, 0x1e63, 0, 0, 0x0219, 0x015f, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0x1e6b, 0x1e97, 0, 0, 0, 0x0165, 0, 0, 0, 0, 0, 0x1e6d, 0, 0, 0x021b, 0x0163, 0, 0x1e71, 0, 0, 0x1e6f, 0, 0, 0, 0 },
    { 0x00f9, 0x00fa, 0x00fb, 0x0169, 0x016b, 0x016d, 0, 0x00fc, 0x1ee7, 0x016f, 0x0171, 0x01d4, 0x0215, 0x0217, 0, 0, 0x01b0, 0x1ee5, 0x1e73, 0, 0, 0, 0x0173, 0x1e77, 0 { 0x00c8, 0x00c9, 0x00ca, 0x1ebc, 0x0112, 0x0114, 0x0116, 0x00cb, 0x1eba, 0, 0, 0x011a, 0x0204, 0x0206, 0, 0, 0, 0x1eb8, 0, 0, 0, 0x0228, 0x0118, 0x1e18, 0, 0x1e1a, 0, 0, 0, 0, 0 },
    { 0, 0x01f4, 0x011c, 0, 0x1e20, 0x011e, 0x0120, 0, 0, 0, 0, 0x01e6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0122, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0x0124, 0, 0, 0, 0x1e22, 0x1e26, 0, 0, 0, 0x021e, 0, 0, 0, 0, 0, 0x1e24, 0, 0, 0, 0x1e28, 0, 0, 0x1e2a, 0, 0, 0, 0, 0, 0 },
    { 0x00cc, 0x00cd, 0x00ce, 0x0128, 0x012a, 0x012c, 0x0130, 0x00cf, 0x1ec8, 0, 0226d }, { 0x0338, 0x2262 }, { 0x0338, 0x2270 }, { 0x0338, 0x2271 }, { 0x0338, 0x2274 }, { 0x0338, 0x2275 }, { 0x0338, 0x2278 }, { 0x0338, 0x2279 },
    { 0x0338, 0x2280 }, { 0x0338, 0x2281 }, { 0x0338, 0x22e0 }, { 0x0338, 0x22e1 }, { 0x0338, 0x2284 }, { 0x0338, 0x2285 }, { 0x0338, 0x2288 }, { 0x0338, 0x2289 }, { 0x0338, 0x22e2 }, { 0x0338, 0x22e3 }, { 0x0338, 0x22ac },
    { 0x0338, 0x22ad }, { 0x0338, 0x22ae }, { 0x0338, 0x22af }, { 0x0338, 0x22ea }, { 0x0338, 0x22eb }, { 0x0338, 0x22ec }, { 0x0338, 0x22ed }, { 0x3099, 0x3094 }, {38, 239, 240, 241, 110, 111, 242, 243, 244, 245, 246, 247, 112, 113, 0,   0,   0,   0,   0,   0,   114, 115, 0,   0, 0, 0,   0,   0,   116, 117, 248, 249, 250, 251, 252, 253, 118, 119, 254,
      255, 256, 257, 258, 259, 120, 121, 0,   0,   0,   0,   0,   0,   122, 123, 0,   0,   0,   0,   0,   0,   124, 125, 0,   0,   0,   0,   0, 0, 126, 127, 0,   0,   0,   0,   0,   0,   128, 129, 0,   0,   0,   0,
      0,   0,   0,   130, 0,   0,   0,   0,   0,   0,   131, 132, 260, 261, 262, 263, 264, 265, 133, 134, 266, 267, 268, 269, 270, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221,
      0, 0, 398, 0, 0, 0, 103, 0, 0, 0, 222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 399, 400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { /* page 13, index 9 */
      0, 0, 0, 0, 0, 0, 0,   0,   0, 0, 0,   0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,   0, 0,   0, 0, 0,   0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 401, 0,
      0, 0, 0, 0, 0, 0, 104, 223, 0, 0 0,  0, 0, 0, 0,   0,   0 },
    { /* page 4, index 4 */
      0, 0,  0,  0,   0,  0, 188, 0, 0,   0,   0,   0, 0,   0,   0, 0,  89, 0, 0, 189, 0, 90, 91, 190, 92,  0,   191, 0, 0, 0, 192, 0, 0, 0, 0,   93, 0, 0, 0, 193, 0, 0, 0, 194, 0, 195, 0, 0, 94, 0, 0, 196,
      0, 95, 96, 197, 97, 0, 198, 0, 0,   0,   199, 0, 0,   0,   0, 98, 0,  0, 0, 200, 0, 0,  0,  201, 0,   202, 0,   0, 0, 0, 0,   0, 0, 0, 203, 0,  0, 0, 0, 0,   0, 0, 0, 0,   0, 0,   0, 0, 0,  0, 0, 0,
      0, 0,  0,  0,   0,  0, 0,   0, 0,   0,   0,   0, 204, 205, 0, er_ps_file_set_duplex(PopplerPSFile *ps_file, gboolean duplex);
POPPLER_PUBLIC
void poppler_ps_file_free(PopplerPSFile *ps_file);

POPPLER_PUBLIC
void poppler_document_sign(PopplerDocument *document, const PopplerSigningData *signing_data, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
POPPLER_PUBLIC
gboolean poppler_document_sign_finish(PopplerDocument *document, GAsyncResult *result, GError **error);

/**
 * PopplerPageRange:
 * @start_page: first page in the range of pages
 * @end_page:   last pagepler_document_set_producer(PopplerDocument *document, const gchar *producer);
POPPLER_PUBLIC
time_t poppler_document_get_creation_date(PopplerDocument *document);
POPPLER_PUBLIC
void poppler_document_set_creation_date(PopplerDocument *document, time_t creation_date);
POPPLER_PUBLIC
GDateTime *poppler_document_get_creation_date_time(PopplerDocument *document);
POPPLER_PUBLIC
void poppler_document_set_creation_date_time(PopplerDocument *document, GDateTime *creation_datetime);
POPPLER_PUBLIC
time_t poppler_document_get_modification_dR_PDF_SUBTYPE_PART_NONE
} PopplerPDFPart;

/**
 * PopplerPDFConformance:
 * @POPPLER_PDF_SUBTYPE_CONF_UNSET: Null
 * @POPPLER_PDF_SUBTYPE_CONF_A: Level A (accessible) conformance (PDF/A)
 * @POPPLER_PDF_SUBTYPE_CONF_B: Level B (basic) conformance (PDF/A)
 * @POPPLER_PDF_SUBTYPE_CONF_G: Level G (external graphical content) (PDF/X)
 * @POPPLER_PDF_SUBTYPE_CONF_N: Level N (external ICC Profile) (PDF/X)
 * @POPPLER_PDF_SUBTYPE_CONF_P: Level P (ICC Profile) (PDF/X)
 * @POPPLER_PDF_SUBTYPE_CONF_PG: Level PG (conjunction of P and G) (PDF/ment is active
 * @POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI: hide UI elements in document's window
 * @POPPLER_VIEWER_PREFERENCES_FIT_WINDOW: resize document's window to fit the size of the first displayed page
 * @POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW: position the document's window in the center of the screen
 * @POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE: display document title in window's title bar
 * @POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL: the predominant reading order for text is right to left
 *
 * Viewer preferences*obj);

    int catalogPdfMajorVersion = -1;
    int catalogPdfMinorVersion = -1;

    mutable std::recursive_mutex mutex;
};

#endif
/* poppler-document.h: glib interface to poppler
 * Copyright (C) 2004, Red Hat, Inc.
 *
 * Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
 * Copyright (C) 2018, 2019, 2021, 2022 Marek Kasik <mkasik@redhat.com>
 * Copyright (C) 2019 Masamichi Hosoda <trueroad@trueroad.jp>
 * Copyright (C) 2021 AndrÃ© Guerreiro <aguerreiro1985@gmail.com>
 * Copyright (C) 2025 Marco Trevisan <mail@3v1n0.net>
 *
 *= 1 << 2,
        markInfoSuspects = 1 << 3,
    };
    unsigned int getMarkInfo();

    // Find a page, given its object ID.  Returns page number, or 0 if
    // not found.
    int findPage(const Ref pageRef);

    // Find a named destination.  Returns the link destination, or
    // NULL if <name> is not a destination.
    std::unique_ptr<LinkDest> findDest(const GooString *name);

    Object *getDests();

    // Get the number of named destinations in name-dict
    int numDests();

    // Get the i'th named destination name in nILE *fout, const UnicodeMap *uMap);

    // scan but exit after finding first JS in the PDF
    void scanJS(int nPages, bool stopOnFirstJS);

    // return true if PDF contains JavaScript
    bool containsJS();

private:
    PDFDoc *doc;
    int currentPage;
    bool hasJS;
    bool print;
    FILE *file;
    const UnicodeMap *uniMap;
    bool onlyFirstJS; /* stop scanning after finding first JS */

    void scan(int nPages);
    void scanLinkAction(LinkAction *link, const char *action);
    void printJS(std::string_view js);
};

# ax, 0xf3ff;
    __asm or ax, 0x0800;
    __asm mov WORD PTR newCW, ax; // round up
    __asm fldcw WORD PTR newCW;
    __asm fistp DWORD PTR result;
    __asm fldcw WORD PTR oldCW;
    return result;
#else
    return (int)ceil(x);
#endif
}

static inline int splashRound(SplashCoord x)
{
#if defined(__GNUC__) && defined(__i386__)
    // this could use round-to-nearest mode and avoid the "+0.5",
    // but that produces slightly different results (because i+0.5
    // sometimes rounds up and sometimes down using the even rule)
    ufldcw  %1\n"
                     "fistpl %2\n"
                     "fldcw  %0\n"
                     : "=m"(oldCW), "=m"(newCW), "=m"(result), "=r"(t)
                     : "m"(x));
    return result;
#elif defined(_WIN32) && defined(_M_IX86)
    // floor() and (int)() are implemented separately, which results
    // in changing the FPCW multiple times - so we optimize it with
    // some inline assembly
    unsigned short oldCW, newCW;
    int result;

    __asm fld QWORD PTR x;
    __asm fnstcw WORD PTR oldCW;
    __asm mov aType1CPrivateDict *pDict);
    void readFDSelect();
    void buildEncoding();
    bool readCharset();
    int getOp(int pos, bool charstring, bool *ok);
    int getDeltaIntArray(int *arr, int maxLen) const;
    int getDeltaFPArray(double *arr, int maxLen) const;
    void getIndex(int pos, Type1CIndex *idx, bool *ok) const;
    void getIndexVal(const Type1CIndex *idx, int i, Type1CIndexVal *val, bool *ok) const;
    char *getString(int sid, char *buf, bool *ok) const;

    std::unique_ptr<GooString> name;
    char **encoding;

    T is used
    // (3) is <codeMap> is NULL and this is an 8-bit CFF font, then
    //     the identity CID-to-GID mapping is used
    void convertToCIDType0(const char *psName, const std::vector<int> &codeMap, FoFiOutputFunc outputFunc, void *outputStream);

    // Convert to a Type 0 (but non-CID) composite font, suitable for
    // embedding in a PostScript file.  <psName> will be used as the
    // PostScript font name.  There are three cases for the CID-to-GID
    // mapping:
    // (1) if <codeMap> is non-NULL, then it is the CIle fontMatrix[6];
    bool hasFontMatrix; // CID fonts are allowed to put their
                        //   FontMatrix in the FD instead of the
                        //   top dict
    int uniqueID;
    double fontBBox[4];
    double strokeWidth;
    int charsetOffset;
    int encodingOffset;
    int charStringsOffset;
    int privateSize;
    int privateOffset;

    // CIDFont entries
    int registrySID;
    int orderingSID;
    int supplement;
    int fdArrayOffset;
    int fdSelectOffset;
};

#define type1CMaxBlueValues 14
#d7, 0xb4, 1 }, { 0x00f7, 0x00f7, 0xb8, 1 }, { 0x0192, 0x0192, 0xa6, 1 },
    { 0x0391, 0x0392, 0x41, 1 }, { 0x0393, 0x0393, 0x47, 1 }, { 0x0395, 0x0395, 0x45, 1 }, { 0x0396, 0x0396, 0x5a, 1 }, { 0x0397, 0x0397, 0x48, 1 }, { 0x0398, 0x0398, 0x51, 1 }, { 0x0399, 0x0399, 0x49, 1 }, { 0x039a, 0x039d, 0x4b, 1 },
    { 0x039e, 0x039e, 0x58, 1 }, { 0x039f, 0x03a0, 0x4f, 1 }, { 0x03a1, 0x03a1, 0x52, 1 }, { 0x03a3, 0x03a5, 0x53, 1 }, { 0x03a6, 0x03a6, 0x46, 1 }, { 0x03a7, 0x03a7, 0x43, 1 }, { 0x03a8, 0x03a8, 0x59, 1 }, { 0x03b1, 0x03b2, 0x6112, 0x2212, 0x2d, 1 },     { 0xf6f9, 0xf6f9, 0x4c, 1 },     { 0xf6fa, 0xf6fa, 0x4f45, 2 },   { 0xf6fc, 0xf6fc, 0xb0, 1 },  { 0xf6fd, 0xf6fd, 0x53, 1 },   { 0xf6fe, 0xf6fe, 0x7e, 1 },   { 0xf6ff, 0xf6ff, 0x5a, 1 },
    { 0xf721, 0xf721, 0x21, 1 },     { 0xf724, 0xf724, 0x24, 1 },     { 0xf726, 0xf726, 0x26, 1 },     { 0xf730, 0xf739, 0x30, 1 },  { 0xf73f, 0xf73f, 0x3f, 1 },   { 0xf761, 0xf77a, 0x41, 1 },   { 0xf7a1, 0xf7a2, 0xa1, 1 },
    { 0xf7bf, 0xf7bf, 0xbf, 1 },     { 0xf7e0, 0xf7f6, 0xc0, 1 },     { 0xf7f8, 0xf7fe, 0xd8, 1 }, rn void POPPLER_PRIVATE_EXPORT setErrorCallback(ErrorCallback cbk);

extern void CDECL POPPLER_PRIVATE_EXPORT error(ErrorCategory category, Goffset pos, const char *msg, ...) GOOSTRING_FORMAT;

enum class ErrorStringType
{
    ErrorCodeString,
    UserString
};

struct ErrorString
{
    std::string text;
    ErrorStringType type;
};

#if defined(_MSC_VER)
#    define POPPLER_FUNCTION_INFO __FUNCSIG__
#elif defined(__GNUC__) // this should also cover clang
#    define POPPLER_FUNCTION_INFO __PRETTY_FUNCTION__
#else // fallback
#    PPLER_DOCUMENT_H

#include "poppler-global.h"
#include "poppler-font.h"

#include <map>

namespace poppler {

class destination;
class document_private;
class embedded_file;
class page;
class toc;

class POPPLER_CPP_EXPORT document : public poppler::noncopyable
{
public:
    enum page_mode_enum
    {
        use_none,
        use_outlines,
        use_thumbs,
        fullscreen,
        use_oc,
        use_attach
    };

    enum page_layout_enum
    {
        no_layout,
        single_page,
        one_column,
        two_column_lSeparationInfo() { return attrs->getSeparationInfo(); }
    PDFDoc *getDoc() { return doc; }
    Ref getRef() { return pageRef; }

    // Keep in API. This is used by GDAL
    const Object &getPageObj() const { return pageObj; }

    // Get resource dictionary.
    Dict *getResourceDict();
    Object *getResourceDictObject();
    Dict *getResourceDictCopy(XRef *xrefA);

    // Get annotations array.
    Object getAnnotsObject(XRef *xrefA = nullptr) { return annotsObj.fetch(xrefA ? xrefA : xref); }
    // Add a new annotation to theass PDFDoc;
class XRef;
class OutputDev;
class Links;
class LinkAction;
class Annots;
class Annot;
class Gfx;
class FormPageWidgets;
class Form;
class FormField;

//------------------------------------------------------------------------

class PDFRectangle
{
public:
    double x1, y1, x2, y2;

    PDFRectangle() { x1 = y1 = x2 = y2 = 0; }
    PDFRectangle(double x1A, double y1A, double x2A, double y2A)
    {
        x1 = x1A;
        y1 = y1A;
        x2 = x2A;
        y2 = y2A;
    }
    bool isValid() const { return x1 != 0 || yle getScale() const { return scale; }

    // Is rectangular?
    bool isRectangular() const { return rectangular; }

private:
    PageTransitionType type; // transition style
    double duration; // duration of the effect in seconds
    PageTransitionAlignment alignment; // dimension of the effect
    PageTransitionDirection direction; // direction of motion
    int angle; // direction in degrees
    double scale; // scale
    bool rectangular; // is the area to be flown in rectangular?
    bool ok; // set if created successfully
ntFile *fontFileA, const SplashCoord *matA, const SplashCoord *textMatA) const
    {
        return fontFileA == fontFile && matA[0] == mat[0] && matA[1] == mat[1] && matA[2] == mat[2] && matA[3] == mat[3] && textMatA[0] == textMat[0] && textMatA[1] == textMat[1] && textMatA[2] == textMat[2] && textMatA[3] == textMat[3];
    }

    // Get a glyph - this does a cache lookup first, and if not found,
    // creates a new bitmap and adds it to the cache.  The <xFrac> and
    // <yFrac> values are splashFontFractionBits bits each, repreL: print main document contents and all markup annotations
 *
 * Printing flags
 *
 * Deprecated: 25.02: Use poppler_page_render_full() and
 * #PopplerRenderAnnotsFlags instead.
 *
 * Since: 0.16
 */
typedef enum /*< flags >*/
{
    POPPLER_PRINT_DOCUMENT = 0,
    POPPLER_PRINT_MARKUP_ANNOTS = 1 << 0,
    POPPLER_PRINT_STAMP_ANNOTS_ONLY = 1 << 1,
    POPPLER_PRINT_ALL = POPPLER_PRINT_MARKUP_ANNOTS
} PopplerPrintFlags G_GNUC_DEPRECATED_FOR(PopplerRenderAnnotsFlags);

/**
 * PopplerFindFlags:
 * @POPPLER_FIND_DEFAULT: use default seaER_PAGE_TRANSITION_OUTWARD
} PopplerPageTransitionDirection;

/**
 * PopplerSelectionStyle:
 * @POPPLER_SELECTION_GLYPH: glyph is the minimum unit for selection
 * @POPPLER_SELECTION_WORD: word is the minimum unit for selection
 * @POPPLER_SELECTION_LINE: line is the minimum unit for selection
 *
 * Selection styles
 */
typedef enum
{
    POPPLER_SELECTION_GLYPH,
    POPPLER_SELECTION_WORD,
    POPPLER_SELECTION_LINE
} PopplerSelectionStyle;

/**
 * PopplerRenderFlags:
 * @POPPLER_RENDER_ANNOTS_NONE: do not render annotations
 * @P                        { 0x04cc, "chekhakassiancyrillic" },
                                                                { 0x04b9, "cheverticalstrokecyrillic" },
                                                                { 0x03c7, "chi" },
                                                                { 0x3277, "chieuchacirclekorean" },
                                                                { 0x3217, "chieuchaparenkorean" },
                                                                { 0x3269, "chieuchcirclek                                   { 0x0311, "breveinvertedcmb" },
                                                                { 0x0361, "breveinverteddoublecmb" },
                                                                { 0x032a, "bridgebelowcmb" },
                                                                { 0x033a, "bridgeinvertedbelowcmb" },
                                                                { 0x00a6, "brokenbar" },
                                                                { 0x0180, "bstroke"   { 0xfe3c, "blacklenticularbracketrightvertical" },
                                                                { 0x25e3, "blacklowerlefttriangle" },
                                                                { 0x25e2, "blacklowerrighttriangle" },
                                                                { 0x25ac, "blackrectangle" },
                                                                { 0x25ba, "blackrightpointingpointer" },
                                                                { 0x25b6, "blac                                 { 0x3079, "behiragana" },
                                                                { 0xfe92, "behmedialarabic" },
                                                                { 0xfc9f, "behmeeminitialarabic" },
                                                                { 0xfc08, "behmeemisolatedarabic" },
                                                                { 0xfc6d, "behnoonfinalarabic" },
                                                                { 0x30d9, "bekatakan                                            { 0x21d1, "arrowdblup" },
                                                                { 0x2193, "arrowdown" },
                                                                { 0x2199, "arrowdownleft" },
                                                                { 0x2198, "arrowdownright" },
                                                                { 0x21e9, "arrowdownwhite" },
                                                                { 0x02c5, "arrowheaddownmod" },
                                  { 0x3124, "angbopomofo" },
                                                                { 0x0e5a, "angkhankhuthai" },
                                                                { 0x2220, "angle" },
                                                                { 0x3008, "anglebracketleft" },
                                                                { 0xfe3f, "anglebracketleftvertical" },
                                                                { 0x3009, "anglebracketright" },
                                                         { 0x30a2, "akatakana" },
                                                                { 0xff71, "akatakanahalfwidth" },
                                                                { 0x314f, "akorean" },
                                                                { 0x05d0, "alef" },
                                                                { 0x0627, "alefarabic" },
                                                                { 0xfb30, "alefdageshhebrew" },
 afii57519" },
                                                                { 0x06d5, "afii57534" },
                                                                { 0x20aa, "afii57636" },
                                                                { 0x05be, "afii57645" },
                                                                { 0x05c3, "afii57658" },
                                                                { 0x05d0, "afii57664" },
                                                                { 0x05d1, "afiafii57409" },
                                                                { 0x0622, "afii57410" },
                                                                { 0x0623, "afii57411" },
                                                                { 0x0624, "afii57412" },
                                                                { 0x0625, "afii57413" },
                                                                { 0x0626, "afii57414" },
                                                                { 0x0627, "afi,
                                                                { 0x0447, "afii10089" },
                                                                { 0x0448, "afii10090" },
                                                                { 0x0449, "afii10091" },
                                                                { 0x044a, "afii10092" },
                                                                { 0x044b, "afii10093" },
                                                                { 0x044c, "afii10094" },
 
                                                                { 0x041f, "afii10033" },
                                                                { 0x0420, "afii10034" },
                                                                { 0x0421, "afii10035" },
                                                                { 0x0422, "afii10036" },
                                                                { 0x0423, "afii10037" },
                                                                { 0x0424, "afii10038" },
                            { 0x0a3e, "aamatragurmukhi" },
                                                                { 0x3303, "aarusquare" },
                                                                { 0x09be, "aavowelsignbengali" },
                                                                { 0x093e, "aavowelsigndeva" },
                                                                { 0x0abe, "aavowelsigngujarati" },
                                                                { 0x055f, "abbreviationmarkarmenia                                        { 0x03d4, "Upsilondieresishooksymbolgreek" },
                                                                { 0x03d2, "Upsilonhooksymbol" },
                                                                { 0x038e, "Upsilontonos" },
                                                                { 0x016e, "Uring" },
                                                                { 0x040e, "Ushortcyrillic" },
                                                                { 0xf775, "Usmall"                                                           { 0xf7fb, "Ucircumflexsmall" },
                                                                { 0x0423, "Ucyrillic" },
                                                                { 0x0170, "Udblacute" },
                                                                { 0x0214, "Udblgrave" },
                                                                { 0x00dc, "Udieresis" },
                                                                { 0x01d7, "Udieresisacute"      { 0x03da, "Stigmagreek" },
                                                                { 0x0054, "T" },
                                                                { 0x03a4, "Tau" },
                                                                { 0x0166, "Tbar" },
                                                                { 0x0164, "Tcaron" },
                                                                { 0x0162, "Tcedilla" },
                                                                { 0x24c9, "Tcircle"                                                                { 0xf772, "Rsmall" },
                                                                { 0x0281, "Rsmallinverted" },
                                                                { 0x02b6, "Rsmallinvertedsuperior" },
                                                                { 0x0053, "S" },
                                                                { 0x250c, "SF010000" },
                                                                { 0x2514, "SF020000" }                                                             { 0x1edc, "Ohorngrave" },
                                                                { 0x1ede, "Ohornhookabove" },
                                                                { 0x1ee0, "Ohorntilde" },
                                                                { 0x0150, "Ohungarumlaut" },
                                                                { 0x01a2, "Oi" },
                                                                { 0x020e, "Oinvertedbreve"                                                         { 0x1e4a, "Ncircumflexbelow" },
                                                                { 0x0145, "Ncommaaccent" },
                                                                { 0x1e44, "Ndotaccent" },
                                                                { 0x1e46, "Ndotbelow" },
                                                                { 0x019d, "Nhookleft" },
                                                                { 0x2168, "Nineroman" },
                                                        { 0x0197, "Istroke" },
                                                                { 0x0128, "Itilde" },
                                                                { 0x1e2c, "Itildebelow" },
                                                                { 0x0474, "Izhitsacyrillic" },
                                                                { 0x0476, "Izhitsadblgravecyrillic" },
                                                                { 0x004a, "J" },
                                             { 0x04a8, "Haabkhasiancyrillic" },
                                                                { 0x04b2, "Hadescendercyrillic" },
                                                                { 0x042a, "Hardsigncyrillic" },
                                                                { 0x0126, "Hbar" },
                                                                { 0x1e2a, "Hbrevebelow" },
                                                                { 0x1e28, "Hcedilla" },
 { 0x3387, "GBsquare" },
                                                                { 0x01f4, "Gacute" },
                                                                { 0x0393, "Gamma" },
                                                                { 0x0194, "Gammaafrican" },
                                                                { 0x03ea, "Gangiacoptic" },
                                                                { 0x011e, "Gbreve" },
                                                                { 0x01e6"Dmonospace" },
                                                                { 0xf6f7, "Dotaccentsmall" },
                                                                { 0x0110, "Dslash" },
                                                                { 0xf764, "Dsmall" },
                                                                { 0x018b, "Dtopbar" },
                                                                { 0x01f2, "Dz" },
                                                                { 0x01c5, "Dzcaron" },
                                                                { 0x24b8, "Ccircle" },
                                                                { 0x0108, "Ccircumflex" },
                                                                { 0x010a, "Cdot" },
                                                                { 0x010a, "Cdotaccent" },
                                                                { 0xf7b8, "Cedillasmall" },
                                                                { 0x0549, "Chaarmenian" },
                                               { 0x0200, "Adblgrave" },
                                                                { 0x00c4, "Adieresis" },
                                                                { 0x04d2, "Adieresiscyrillic" },
                                                                { 0x01de, "Adieresismacron" },
                                                                { 0xf7e4, "Adieresissmall" },
                                                                { 0x1ea0, "Adotbelow" },
  cape.us>
// Copyright (C) 2022, 2023 Vincent Lefevre <vincent@vinc17.net>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================

#include "CharTypes.h"

#include <cstddef>

struct NameToUnicodeTab
{
    Unicode u;
    const char *name;
};

// map character names to Unicode
static const struct NameToUnicodeTab nameToUnicodeTextTab[] = { { 0x0021, "!" },
   pyright 2015 AndrÃ© Esser <bepandre@hotmail.com>
// Copyright 2015, 2017, 2018, 2020 Albert Astals Cid <aacid@kde.org>
// Copyright 2017 Hans-Ulrich JÃ¼ttner <huj@froreich-bioscientia.de>
// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@protonmail.com>
// Copyright 2018 Oliver Sander <oliver.sander@tu-dresden.de>
// Copyright 2021 Georgiy Sgibnev <georgiy@sgibnev.com>. Work sponsored by lab50.net.
// Copyright 2021 AndrÃ© Guerreiro <aguerreiro1985@gmail.com>
// Copyright 2021 Marek Kasik <mkasik@redhat.com>
// Copyright 2023, yMaxA);
    SplashError fillWithPattern(SplashPath *path, bool eo, SplashPattern *pattern, SplashCoord alpha);
    bool pathAllOutside(SplashPath *path);
    void fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, bool noclip);
    void arbitraryTransformMask(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, SplashCoord *mat, bool glyphMode);
    SplashBitmap *scaleMask(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight);
    void scaleMaskYdownXdown(SplasawImage(SplashImageSource src, SplashICCTransform tf, void *srcData, SplashColorMode srcMode, bool srcAlpha, int w, int h, SplashCoord *mat, bool interpolate, bool tilingPattern = false);

    // Composite a rectangular region from <src> onto this Splash
    // object.
    SplashError composite(SplashBitmap *src, int xSrc, int ySrc, int xDest, int yDest, int w, int h, bool noClip, bool nonIsolated, bool knockout = false, SplashCoord knockoutOpacity = 1.0);

    // Composite this Splash object onto a background color.  The
    // baPtr pixel);

// Retrieves the next line of pixels in an image.  Normally, fills in
// *<line> and returns true.  If the image stream is exhausted,
// returns false.
typedef bool (*SplashImageSource)(void *data, SplashColorPtr colorLine, unsigned char *alphaLine);

// Use ICCColorSpace to transform a bitmap
typedef void (*SplashICCTransform)(void *data, SplashBitmap *bitmap);

//------------------------------------------------------------------------

enum SplashPipeResultColorCtrl
{
    splashPipeResultColorNoAlphaBlendCMYK,
    sp-- functions to set parameters
    void addFontFile(const std::string &fontName, const std::string &path);
    void setTextEncoding(const std::string &encodingName);
    void setPrintCommands(bool printCommandsA);
    void setProfileCommands(bool profileCommandsA);
    void setErrQuiet(bool errQuietA);
#ifdef ANDROID
    static void setFontDir(const std::string &fontDir);
#endif
    static bool parseYesNo2(const char *token, bool *flag);

private:
    void parseNameToUnicode(const std::filesystem::path &name);

    void scanEncodinight (C) 2005, 2007-2010, 2012, 2015, 2017-2024 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com>
// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
// Copyright (C) 2006 Kristian HÃ¸gsberg <krh@redhat.com>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2009 Jonathan Kew <jonathan_kew@sil.org>
// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <williambader@hotmail.com>
// Copyright (C) 2010 H    GooString *getExpandedAbbr() { return isContent() ? nullptr : s->expandedAbbr.get(); }

    unsigned getNumChildren() const { return isContent() ? 0 : s->elements.size(); }
    const StructElement *getChild(int i) const { return isContent() ? nullptr : s->elements.at(i); }
    StructElement *getChild(int i) { return isContent() ? nullptr : s->elements.at(i); }

    void appendChild(StructElement *element)
    {
        if (!isContent() && element && element->isOk()) {
            s->elements.push_back(element);
        }
    }
 StructElement;
class StructTreeRoot;

class POPPLER_PRIVATE_EXPORT Attribute
{
public:
    enum Type
    {
        Unknown = 0, // Uninitialized, parsing error, etc.
        UserProperty, // User defined attribute (i.e. non-standard)

        // Common standard attributes
        Placement,
        WritingMode,
        BackgroundColor,
        BorderColor,
        BorderStyle,
        BorderThickness,
        Color,
        Padding,

        // Block element standard attributes
        SpaceBefore,
        SpaceAfter,
        Staretes the stream when
    // lexer is deleted.
    Lexer(XRef *xrefA, std::unique_ptr<Stream> &&str);

    // Construct a lexer for a stream or array of streams (assumes obj
    // is either a stream or array of streams).
    Lexer(XRef *xrefA, Object *obj);

    // Destructor.
    ~Lexer();

    Lexer(const Lexer &) = delete;
    Lexer &operator=(const Lexer &) = delete;

    // Get the next object from the input stream.
    Object getObj(int objNum = -1);
    Object getObj(const char *cmdA, int objNum);
    template<typename T>
  eImgFile(SplashImageFileFormat format, FILE *f, double hDPI, double vDPI, WriteImgParams *params = nullptr);
    SplashError writeImgFile(ImgWriter *writer, FILE *f, double hDPI, double vDPI, SplashColorMode imageWriterFormat);

    enum ConversionMode
    {
        conversionOpaque,
        conversionAlpha,
        conversionAlphaPremultiplied
    };

    bool convertToXBGR(ConversionMode conversionMode = conversionOpaque);

    void getPixel(int x, int y, SplashColorPtr pixel);
    void getRGBLine(int y, SplashColorPtr line);
   tionMovieOperation operation;
    PopplerMovie *movie;
};

/**
 * PopplerActionRendition:
 * @type: action type (%POPPLER_ACTION_RENDITION)
 * @title: action title
 * @op: operation
 * @media: media
 *
 * Play multimedia content.
 *
 * Since: 0.14
 */
struct _PopplerActionRendition
{
    PopplerActionType type;
    gchar *title;

    gint op;
    PopplerMedia *media;
};

/**
 * PopplerActionOCGState:
 * @type: action type (%POPPLER_ACTION_OCG_STATE)
 * @title: action title
 * @state_list: (element-type PopplerActionLayer): list of fit the rectangle specified by the coordinates left, bottom,
 * right, and top entirely within the window both horizontally and vertically
 * @POPPLER_DEST_FITB: go to page with its contents magnified just enough to fit
 * its bounding box entirely within the window both horizontally and vertically
 * @POPPLER_DEST_FITBH: go to page with the vertical
 * coordinate top positioned at the top edge of the window and the
 * contents of the page magnified just enough to fit the entire width of its
 * bounding box within the window
 * @POION_GOTO_DEST: go to destination
 * @POPPLER_ACTION_GOTO_REMOTE: go to destination in another document
 * @POPPLER_ACTION_LAUNCH: launch app (or open document)
 * @POPPLER_ACTION_URI: URI
 * @POPPLER_ACTION_NAMED: predefined action
 * @POPPLER_ACTION_MOVIE: play movies. Since 0.14
 * @POPPLER_ACTION_RENDITION: play multimedia content. Since 0.14
 * @POPPLER_ACTION_OCG_STATE: state of layer. Since 0.14
 * @POPPLER_ACTION_JAVASCRIPT: Javascript. Since 0.18
 * @POPPLER_ACTION_RESET_FORM: resets form. Since 0.90
 *
 * Action types
 */
BLIC
void poppler_annot_stamp_set_icon(PopplerAnnotStamp *poppler_annot, PopplerAnnotStampIcon icon);
POPPLER_PUBLIC
gboolean poppler_annot_stamp_set_custom_image(PopplerAnnotStamp *poppler_annot, cairo_surface_t *image, GError **error);

/* Paths of PopplerAnnotInk */
POPPLER_PUBLIC
GType poppler_path_get_type(void) G_GNUC_CONST;
POPPLER_PUBLIC
PopplerPath *poppler_path_new_from_array(PopplerPoint *points, gsize n_points);
POPPLER_PUBLIC
void poppler_path_free(PopplerPath *path);
POPPLER_PUBLIC
PopplerPath *poppler_path_copy(Poppl_annot_markup_get_external_data(PopplerAnnotMarkup *poppler_annot);

/**
 * PopplerAnnotText:
 *
 * An annotation for text.
 *
 * Since 25.06 this type supports g_autoptr
 */
POPPLER_PUBLIC
GType poppler_annot_text_get_type(void) G_GNUC_CONST;
POPPLER_PUBLIC
PopplerAnnot *poppler_annot_text_new(PopplerDocument *doc, PopplerRectangle *rect);
POPPLER_PUBLIC
gboolean poppler_annot_text_get_is_open(PopplerAnnotText *poppler_annot);
POPPLER_PUBLIC
void poppler_annot_text_set_is_open(PopplerAnnotText *poppler_annot, gboolean is_open);
POEXT_STATE_NONE,
    POPPLER_ANNOT_TEXT_STATE_UNKNOWN
} PopplerAnnotTextState;

typedef enum
{
    POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED,
    POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED,
    POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED
} PopplerAnnotFreeTextQuadding;

struct _PopplerAnnotCalloutLine
{
    gboolean multiline;
    gdouble x1;
    gdouble y1;
    gdouble x2;
    gdouble y2;
    gdouble x3;
    gdouble y3;
};

typedef enum
{
    POPPLER_ANNOT_STAMP_ICON_UNKNOWN = 0,
    POPPLER_ANNOT_STAMP_ICON_APPROVED,
   ANNOT_TEXT))

#define POPPLER_TYPE_ANNOT_TEXT_MARKUP (poppler_annot_text_markup_get_type())
#define POPPLER_ANNOT_TEXT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_TEXT_MARKUP, PopplerAnnotTextMarkup))
#define POPPLER_IS_ANNOT_TEXT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_TEXT_MARKUP))

#define POPPLER_TYPE_ANNOT_FREE_TEXT (poppler_annot_free_text_get_type())
#define POPPLER_ANNOT_FREE_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_FREE_TEXT, PopplerAnnotFreeText))
#deftr;
    char *bufEnd;
    bool eof;

    bool fillBuf();
};

//------------------------------------------------------------------------
// SplashBitmapCMYKEncoder
//
// This stream helps to condense SplashBitmaps (mostly of DeviceN8 type) into
// pure CMYK colors. In particular for a DeviceN8 bitmap it redacts the spot colorants.
//------------------------------------------------------------------------

class SplashBitmapCMYKEncoder : public Stream
{
public:
    explicit SplashBitmapCMYKEncoder(SplashBitmap *bitmapA);
    ~SplashBlic FilterStream
{
public:
    FixedLengthEncoder(Stream *strA, int lengthA);
    ~FixedLengthEncoder() override;
    StreamKind getKind() const override { return strWeird; }
    [[nodiscard]] bool reset() override;
    int getChar() override;
    int lookChar() override;
    std::optional<std::string> getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return {}; }
    bool isBinary(bool /*last = true*/) const override;
    bool isEncoder() const override { return true; }

private:
    int length;
    int count;
};

/define flateMaxDistCodes 30 // max # distance codes

// Huffman code table entry
struct FlateCode
{
    unsigned short len; // code length, in bits
    unsigned short val; // value represented by this code
};

struct FlateHuffmanTab
{
    const FlateCode *codes;
    int maxLen;
};

// Decoding info for length and distance code words
struct FlateDecode
{
    int bits; // # extra bits
    int first; // first length/distance
};

class FlateStream : public FilterStream
{
public:
    FlateStream(Stream *strA, int predictor, int columns, 'DamagedRowsBeforeError' parameter
    bool eof; // true if at eof
    bool nextLine2D; // true if next line uses 2D encoding
    int row; // current row
    unsigned int inputBuf; // input buffer
    int inputBits; // number of bits in input buffer
    int *codingLine; // coding line changing elements
    int *refLine; // reference line changing elements
    int a0i; // index into codingLine
    bool err; // error on current line
    int outputBits; // remaining ouput bits
    int buf; // character buffer

    void addPixels(int ngthA, Object &&dictA) : BaseMemStream(bufA, startA, lengthA, std::move(dictA)) { }
    ~MemStream() override;
};

class AutoFreeMemStream final : public BaseMemStream<const char>
{
    bool filterRemovalForbidden = false;
    std::vector<char> m_data;

public:
    // AutoFreeMemStream takes ownership over the buffer.
    // The buffer should be created using gmalloc().
    AutoFreeMemStream(std::vector<char> &&data, Object &&dictA) : BaseMemStream(data.data(), 0, data.size(), std::move(dictA)), m_data(std::move(data)) { }
    ~Aut += m;
            n += m;
        }
        return n;
    }

    GooFile *file;
    Goffset offset;
    Goffset start;
    bool limited;
    char buf[fileStreamBufSize];
    char *bufPtr;
    char *bufEnd;
    Goffset bufPos;
    Goffset savePos;
    bool saved;
    bool needsEncryptionOnSave; // Needed for FileStreams that point to "external" files
                                // and thus when saving we can't do a raw copy
};

//------------------------------------------------------------------------
// CachedFileStream
//----turn (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
    Goffset getPos() override { return bufPos + (bufPtr - buf); }
    void setPos(Goffset pos, int dir = 0) override;
    Goffset getStart() override { return start; }
    void moveStart(Goffset delta) override;

    int getUnfilteredChar() override { return getChar(); }
    [[nodiscard]] bool unfilteredReset() override { return reset(); }

protected:
    Goffset start;
    bool limited;

private:
    bool fillBuf();

    bool hasGetChars() override { return true; }
_EXPORT BaseStream : public Stream
{
public:
    BaseStream(Object &&dictA, Goffset lengthA);
    ~BaseStream() override;
    virtual BaseStream *copy() = 0;
    virtual std::unique_ptr<Stream> makeSubStream(Goffset start, bool limited, Goffset length, Object &&dict) = 0;
    void setPos(Goffset pos, int dir = 0) override = 0;
    bool isBinary(bool last = true) const override { return last; }
    BaseStream *getBaseStream() override { return this; }
    Stream *getUndecodedStream() override { return this; }
    Dict *getDict() oveifndef STREAM_H
#define STREAM_H

#include <atomic>
#include <cstdio>
#include <vector>
#include <span>
#include <optional>

#include "poppler-config.h"
#include "poppler_private_export.h"
#include "Object.h"

class GooFile;
class BaseStream;
class CachedFile;
class SplashBitmap;

//------------------------------------------------------------------------

enum StreamKind
{
    strFile,
    strCachedFile,
    strASCIIHex,
    strASCII85,
    strLZW,
    strRunLength,
    strCCITTFax,
    strDCT,
    strFlate,
    strJBIG2,
    strJPt, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap,
                             bool maskInterpolate) override;

    double getX1() const;
    double getY1() const;
    double getX2() const;
    double getY2() const;
    double getHasGraphics() const;

private:
    PDFRectangle bb;
    bool hasGraphics;

    bool text;
    bool vector;
    bool raster;
    bool lwidth;

    void updatePoint(PDFRectangle *bbA, double x, double y, const GfxState *state);
   UTF-8 bytes required to convert a UTF-16 string to
// UTF-8 (excluding terminating NULL).
int POPPLER_PRIVATE_EXPORT utf16CountUtf8Bytes(const uint16_t *utf16);

// Convert UTF-16 to UTF-8
//  utf16    - UTF-16 string to convert. If not null terminated, ensure
//             maxUtf16 is set the the exact number of code units to convert.
//  maxUtf16 - Maximum number of UTF-16 code units to convert. Conversion stops
//             when either this count is reached or a null is encountered.
// Returns utf8 string.
std::string POPPLE s.insert(0, unicodeByteOrderMark);
}

// check whether string starts with Big-Endian byte order mark and string length is even
inline bool hasUnicodeByteOrderMarkAndLengthIsEven(std::string_view s)
{
    return s.starts_with(unicodeByteOrderMark) && s.length() % 2 == 0;
}

// is a unicode whitespace character
bool UnicodeIsWhitespace(Unicode ucs4);

// Convert a UTF-8 string to a UCS-4
//   utf8      - utf8 bytes
//   ucs4_out   - if not NULL, allocates and returns UCS-4 string. Free with gfree.
//   returns number of UCS-4 characrn defaultRGBProfile; }
    void setDefaultCMYKProfile(const GfxLCMSProfilePtr &profile) { defaultCMYKProfile = profile; }
    GfxLCMSProfilePtr getDefaultCMYKProfile() const { return defaultCMYKProfile; }

    PopplerCache<Ref, GfxICCBasedColorSpace> *getIccColorSpaceCache() { return &iccColorSpaceCache; }
#endif

private:
    double defCTM[6]; // default coordinate transform matrix
    double defICTM[6]; // inverse of default CTM
    std::unique_ptr<std::unordered_map<std::string, ProfileData>> profileHash;

#ifdef USE_CMS
    Gfimage drawing
    // Draw an image mask.  An image mask is a one-bit-per-pixel image, where each pixel
    // can only be 'fill color' or 'transparent'.
    //
    // If 'invert' is false, a sample value of 0 marks the page with the current color,
    // and a 1 leaves the previous contents unchanged. If 'invert' is true, these meanings are reversed.
    virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg);
    virtual void setSoftMaskFromImageMa/) { }
    virtual void restoreState(GfxState * /*state*/) { }

    //----- update graphics state
    virtual void updateAll(GfxState *state);

    // Update the Current Transformation Matrix (CTM), i.e., the new matrix
    // given in m11, ..., m32 is combined with the current value of the CTM.
    // At the same time, when this method is called, state->getCTM() already
    // contains the correct new CTM, so one may as well replace the
    // CTM of the renderer with that.
    virtual void updateCTM(GfxState * /*state*/, double /wn coordinates?
    // (Upside-down means (0,0) is the top left corner of the page.)
    virtual bool upsideDown() = 0;

    // Does this device use drawChar() or drawString()?
    virtual bool useDrawChar() = 0;

    // Does this device use tilingPatternFill()?  If this returns false,
    // tiling pattern fills will be reduced to a series of other drawing
    // operations.
    virtual bool useTilingPatternFill() { return false; }

    // Does this device support specific shading types?
    // see gouraudTriangleShadedFill() and int streamGetChar();
    int streamGetChars(int nChars, unsigned char *buffer);
    void streamSetPos(Goffset pos, int dir = 0);
    Dict *streamGetDict() const;

    // Output.
    const char *getTypeName() const;
    void print(FILE *f = stdout) const;

    double getNumWithDefaultValue(double defaultValue) const
    {
        if (unlikely(type != objInt && type != objInt64 && type != objReal)) {
            return defaultValue;
        }
        return type == objInt ? (double)intg : type == objInt64 ? (double)int64g : real;
   y() const;

    // Deep copies all object types (recursively)
    // except objStream whose refcount is increased by 1
    Object deepCopy() const;

    // If object is a Ref, fetch and return the referenced object.
    // Otherwise, return a copy of the object.
    Object fetch(XRef *xref, int recursion = 0) const;

    // Type checking.
    ObjType getType() const
    {
        CHECK_NOT_DEAD;
        return type;
    }
    bool isBool() const
    {
        CHECK_NOT_DEAD;
        return type == objBool;
    }
    bool isInt() co        \
    }

#define OBJECT_3TYPES_CHECK(wanted_type1, wanted_type2, wanted_type3)                                                                                                                                                                          \
    if (unlikely(type != (wanted_type1)) && unlikely(type != (wanted_type2)) && unlikely(type != (wanted_type3))) {                                                                                                                            \
        ::error(errInternal, 0,       (C) 2007 Julien Rebetez <julienr@svn.gnome.org>
// Copyright (C) 2008 Kees Cook <kees@outflux.net>
// Copyright (C) 2008, 2010, 2017-2021, 2023, 2024 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 Jakub Wilk <jwilk@jwilk.net>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2013, 2017, 2018 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com>
// Copyright (C) 2016, 2020 Jakub Alba <jaku // 00001101000x
    { 12, 34 }, // 000011010010
    { 12, 35 }, // 000011010011
    { 12, 36 }, // 000011010100
    { 12, 37 }, // 000011010101
    { 12, 38 }, // 000011010110
    { 12, 39 }, // 000011010111
    { 11, 21 },  { 11, 21 }, // 00001101100x
    { 12, 42 }, // 000011011010
    { 12, 43 }, // 000011011011
    { 10, 0 },   { 10, 0 },  { 10, 0 },  { 10, 0 }, // 0000110111xx
    { 7, 12 },   { 7, 12 },  { 7, 12 },  { 7, 12 }, // 0000111xxxxx
    { 7, 12 },   { 7, 12 },  { 7, 12 },  { 7, 12 },  { 7, 12 },   { 7, 12 }, { 7, 1 4, 5 },   { 4, 5 },   { 6, 14 },  { 6, 14 },  { 6, 14 },  { 6, 14 }, // 110100xxx
    { 6, 14 },   { 6, 14 },   { 6, 14 },   { 6, 14 },   { 6, 15 },   { 6, 15 },   { 6, 15 },   { 6, 15 }, // 110101xxx
    { 6, 15 },   { 6, 15 },   { 6, 15 },   { 6, 15 },   { 5, 64 },   { 5, 64 },   { 5, 64 },   { 5, 64 }, // 11011xxxx
    { 5, 64 },   { 5, 64 },   { 5, 64 },   { 5, 64 },   { 5, 64 },   { 5, 64 },   { 5, 64 },   { 5, 64 },   { 5, 64 },  { 5, 64 },  { 5, 64 },  { 5, 64 },  { 4, 6 },   { 4, 6 },   { 4, 6 },   { 4, 6 }, // 1110xxxxx
  },   { 5, 8 },   { 5, 9 },   { 5, 9 },   { 5, 9 },   { 5, 9 }, // 10100xxxx
    { 5, 9 },    { 5, 9 },    { 5, 9 },    { 5, 9 },    { 5, 9 },    { 5, 9 },    { 5, 9 },    { 5, 9 },    { 5, 9 },   { 5, 9 },   { 5, 9 },   { 5, 9 },   { 6, 16 },  { 6, 16 },  { 6, 16 },  { 6, 16 }, // 101010xxx
    { 6, 16 },   { 6, 16 },   { 6, 16 },   { 6, 16 },   { 6, 17 },   { 6, 17 },   { 6, 17 },   { 6, 17 }, // 101011xxx
    { 6, 17 },   { 6, 17 },   { 6, 17 },   { 6, 17 },   { 4, 4 },    { 4, 4 },    { 4, 4 },    { 4, 4 }, // 1011xxxxx
    { 4 { 12, 2304 }, // 10111
    { 11, 1856 },     { 11, 1856 }, // 1100x
    { 11, 1920 },     { 11, 1920 }, // 1101x
    { 12, 2368 }, // 11100
    { 12, 2432 }, // 11101
    { 12, 2496 }, // 11110
    { 12, 2560 } // 11111
};

// 1-9 bit codes
static const CCITTCode whiteTab2[512] = {
    { -1, -1 },  { -1, -1 },  { -1, -1 },  { -1, -1 }, // 0000000xx
    { 8, 29 },   { 8, 29 }, // 00000010x
    { 8, 30 },   { 8, 30 }, // 00000011x
    { 8, 45 },   { 8, 45 }, // 00000100x
    { 8, 46 },   { 8, 46 }, // 00000101x
    { 7, 22 },   { 7,urces(const std::string &filepath, int faceIndex, const std::string &fontFamily, const std::string &fontStyle, bool forceName = false);

    AddFontResult doGetAddFontToDefaultResources(Unicode uChar, const GfxFont &fontToEmulate);

    std::vector<std::unique_ptr<FormField>> rootFields;
    PDFDoc *const doc;
    bool needAppearances;
    GfxResources *defaultResources;
    Object resDict;
    std::vector<Ref> calculateOrder;

    // Variable Text
    std::unique_ptr<GooString> defaultAppearance;
    VariableTextQuadding quadding;Object fieldLookup(Dict *field, const char *key);

    /* Creates a new Field of the type specified in obj's dict.
       used in Form::Form , FormField::FormField and
       Page::loadStandaloneFields */
    static std::unique_ptr<FormField> createFieldFromDict(Object &&obj, PDFDoc *docA, const Ref aref, FormField *parent, std::set<int> *usedParents);

    // Finds in the default resources dictionary a font named popplerfontXXX that
    // has the given fontFamily and fontStyle. This makes us relatively sure that we added that fonct, const Ref ref, FormField *parent, std::set<int> *usedParents);

    FormButtonType getButtonType() const { return btype; }

    bool noToggleToOff() const { return noAllOff; }

    // returns true if the state modification is accepted
    bool setState(const char *state, bool ignoreToggleOff = false);
    bool getState(const char *state) const;

    const char *getAppearanceState() const { return appearanceState.isName() ? appearanceState.getName() : nullptr; }
    const char *getDefaultAppearanceState() const { return defaultA checks the length encoding of the signature and returns the hex encoded signature
    // if the check passed (and the checked file size as output parameter in checkedFileSize)
    // otherwise a nullptr is returned
    std::optional<GooString> getCheckedSignature(Goffset *checkedFileSize);

    const std::vector<unsigned char> &getSignature() const;

private:
    bool createSignature(Object &vObj, Ref vRef, const GooString &name, int placeholderLength, const GooString *reason, const GooString *location, CryptoSign::SignatureType setNumChoices() const;
    // return the display name of the i-th choice (UTF16BE)
    const GooString *getChoice(int i) const;
    const GooString *getExportVal(int i) const;
    // select the i-th choice
    void select(int i);
    void setAppearanceChoiceContent(std::unique_ptr<GooString> new_content);
    // toggle selection of the i-th choice
    void toggle(int i);

    // deselect everything
    void deselectAll();

    // except a UTF16BE string
    // only work for editable combo box, set the user-entered text as the currenual void updateWidgetAppearance() = 0;

    void print(int indent = 0);

protected:
    FormWidget(PDFDoc *docA, Object *aobj, unsigned num, Ref aref, FormField *fieldA);

    std::shared_ptr<AnnotWidget> widget;
    FormField *field;
    FormFieldType type;
    Object obj;
    Ref ref;
    PDFDoc *doc;
    XRef *xref;

    // index of this field in the parent's child list
    unsigned childNum;

    /*
    Field ID is an (unsigned) integer, calculated as follow :
    the first sizeof/2 bits are the field number, relative to the pa    virtual HashAlgorithm getHashAlgorithm() const = 0;

    // Blocking if doneCallback to validateCertificateAsync has not yet been called
    virtual CertificateValidationStatus validateCertificateResult() = 0;
    virtual void validateCertificateAsync(std::chrono::system_clock::time_point validation_time, bool ocspRevocationCheck, bool useAIACertFetch, const std::function<void()> &doneCallback) = 0;
    virtual std::unique_ptr<X509CertificateInfo> getCertificateInfo() const = 0;
    virtual ~VerificationInterface();
    Verific/,
    0x3bc /* offset 10 */,
    0x20,
    0x327 /* offset 11 */,
    0x31 /* offset 13 */,
    0x6f /* offset 14 */,
    0x31,
    0x2044,
    0x34 /* offset 15 */,
    0x31,
    0x2044,
    0x32 /* offset 18 */,
    0x33,
    0x2044,
    0x34 /* offset 21 */,
    0x41,
    0x300 /* offset 24 */,
    0x41,
    0x301 /* offset 26 */,
    0x41,
    0x302 /* offset 28 */,
    0x41,
    0x303 /* offset 30 */,
    0x41,
    0x308 /* offset 32 */,
    0x41,
    0x30a /* offset 34 */,
    0x43,
    0x327 /* offset 36 */,
    0x45,
    0407 }, { 0x2f94f, 1, 4494 }, { 0x2f950, 1, 4813 }, { 0x2f951, 1, 6408 }, { 0x2f952, 1, 6409 }, { 0x2f953, 1, 4741 },
    { 0x2f954, 1, 6410 }, { 0x2f955, 1, 6411 }, { 0x2f956, 1, 4698 }, { 0x2f957, 1, 6412 }, { 0x2f958, 1, 6413 }, { 0x2f959, 1, 4744 }, { 0x2f95a, 1, 6414 }, { 0x2f95b, 1, 6415 }, { 0x2f95c, 1, 6416 }, { 0x2f95d, 1, 6417 },
    { 0x2f95e, 1, 6417 }, { 0x2f95f, 1, 6418 }, { 0x2f960, 1, 6419 }, { 0x2f961, 1, 6420 }, { 0x2f962, 1, 6421 }, { 0x2f963, 1, 6422 }, { 0x2f964, 1, 6423 }, { 0x2f965, 1, 6424 }, { 0x2f966, 1, 64 0x2f8cc, 1, 6295 }, { 0x2f8cd, 1, 6296 }, { 0x2f8ce, 1, 6297 }, { 0x2f8cf, 1, 4729 }, { 0x2f8d0, 1, 6298 }, { 0x2f8d1, 1, 6299 },
    { 0x2f8d2, 1, 6300 }, { 0x2f8d3, 1, 6301 }, { 0x2f8d4, 1, 6302 }, { 0x2f8d5, 1, 6303 }, { 0x2f8d6, 1, 6304 }, { 0x2f8d7, 1, 6305 }, { 0x2f8d8, 1, 4477 }, { 0x2f8d9, 1, 4796 }, { 0x2f8da, 1, 6306 }, { 0x2f8db, 1, 6307 },
    { 0x2f8dc, 1, 6308 }, { 0x2f8dd, 1, 6309 }, { 0x2f8de, 1, 6310 }, { 0x2f8df, 1, 6311 }, { 0x2f8e0, 1, 6312 }, { 0x2f8e1, 1, 6313 }, { 0x2f8e2, 1, 4730 }, { 0x2f8e3, 1, 6314 }, {  0x1f14b, 2, 4253 }, { 0x1f14c, 2, 6048 }, { 0x1f14d, 2, 6050 }, { 0x1f14e, 3, 6052 }, { 0x1f14f, 2, 6055 }, { 0x1f16a, 2, 6057 },
    { 0x1f16b, 2, 6059 }, { 0x1f190, 2, 6061 }, { 0x1f200, 2, 6063 }, { 0x1f201, 2, 6065 }, { 0x1f202, 1, 3626 }, { 0x1f210, 1, 2837 }, { 0x1f211, 1, 6067 }, { 0x1f212, 1, 6068 }, { 0x1f213, 2, 3077 }, { 0x1f214, 1, 2780 },
    { 0x1f215, 1, 6069 }, { 0x1f216, 1, 6070 }, { 0x1f217, 1, 3217 }, { 0x1f218, 1, 6071 }, { 0x1f219, 1, 6072 }, { 0x1f21a, 1, 6073 }, { 0x1f21b, 1, 4618 }, { 0x1f21c, 1, 6074 }, {  0x1ee61, 1, 5767 }, { 0x1ee62, 1, 5771 }, { 0x1ee64, 1, 5792 }, { 0x1ee67, 1, 5772 }, { 0x1ee68, 1, 5782 }, { 0x1ee69, 1, 5794 }, { 0x1ee6a, 1, 5788 }, { 0x1ee6c, 1, 5790 }, { 0x1ee6d, 1, 5791 }, { 0x1ee6e, 1, 5778 },
    { 0x1ee6f, 1, 5784 }, { 0x1ee70, 1, 5786 }, { 0x1ee71, 1, 5780 }, { 0x1ee72, 1, 5787 }, { 0x1ee74, 1, 5779 }, { 0x1ee75, 1, 5769 }, { 0x1ee76, 1, 5770 }, { 0x1ee77, 1, 5773 }, { 0x1ee79, 1, 5781 }, { 0x1ee7a, 1, 5783 },
    { 0x1ee7b, 1, 5785 }, { 0x1ee7c, 1, 5936 }, { 0x1ee7e, 1, 5937 }, { 0x1ee80, 1, 5766 }, {  0x1d6f9, 1, 5919 }, { 0x1d6fa, 1, 2321 }, { 0x1d6fb, 1, 5920 }, { 0x1d6fc, 1, 5921 }, { 0x1d6fd, 1, 668 },  { 0x1d6fe, 1, 1017 }, { 0x1d6ff, 1, 1018 },
    { 0x1d700, 1, 677 },  { 0x1d701, 1, 5922 }, { 0x1d702, 1, 5923 }, { 0x1d703, 1, 669 },  { 0x1d704, 1, 2133 }, { 0x1d705, 1, 673 },  { 0x1d706, 1, 5924 }, { 0x1d707, 1, 10 },   { 0x1d708, 1, 5925 }, { 0x1d709, 1, 5926 },
    { 0x1d70a, 1, 5927 }, { 0x1d70b, 1, 672 },  { 0x1d70c, 1, 674 },  { 0x1d70d, 1, 675 },  { 0x1d70e, 1, 5928 }, { 0x1d70f, 1, 5929 }, { 0x1d710, 1, 5930 }, { { 0x1d5d0, 1, 595 },  { 0x1d5d1, 1, 611 },
    { 0x1d5d2, 1, 596 },  { 0x1d5d3, 1, 1053 }, { 0x1d5d4, 1, 973 },  { 0x1d5d5, 1, 975 },  { 0x1d5d6, 1, 2297 }, { 0x1d5d7, 1, 976 },  { 0x1d5d8, 1, 977 },  { 0x1d5d9, 1, 2322 }, { 0x1d5da, 1, 979 },  { 0x1d5db, 1, 980 },
    { 0x1d5dc, 1, 981 },  { 0x1d5dd, 1, 982 },  { 0x1d5de, 1, 983 },  { 0x1d5df, 1, 984 },  { 0x1d5e0, 1, 985 },  { 0x1d5e1, 1, 986 },  { 0x1d5e2, 1, 987 },  { 0x1d5e3, 1, 989 },  { 0x1d5e4, 1, 2312 }, { 0x1d5e5, 1, 990 },
    { 0x1d5e6, 1, 2754 }, { 0x1d5e7, 1, 991 },   },  { 0x1d47f, 1, 2400 }, { 0x1d480, 1, 2755 }, { 0x1d481, 1, 2320 }, { 0x1d482, 1, 3 },    { 0x1d483, 1, 997 },  { 0x1d484, 1, 1023 },
    { 0x1d485, 1, 998 },  { 0x1d486, 1, 999 },  { 0x1d487, 1, 1026 }, { 0x1d488, 1, 1003 }, { 0x1d489, 1, 588 },  { 0x1d48a, 1, 1020 }, { 0x1d48b, 1, 590 },  { 0x1d48c, 1, 1004 }, { 0x1d48d, 1, 610 },  { 0x1d48e, 1, 1005 },
    { 0x1d48f, 1, 2288 }, { 0x1d490, 1, 14 },   { 0x1d491, 1, 1010 }, { 0x1d492, 1, 2756 }, { 0x1d493, 1, 591 },  { 0x1d494, 1, 356 },  { 0x1d495, 1, 1011 }, { 0x1d496, 1,  0x1d44f, 1, 997 },  { 0x1d450, 1, 1023 }, { 0x1d451, 1, 998 },
    { 0x1d452, 1, 999 },  { 0x1d453, 1, 1026 }, { 0x1d454, 1, 1003 }, { 0x1d456, 1, 1020 }, { 0x1d457, 1, 590 },  { 0x1d458, 1, 1004 }, { 0x1d459, 1, 610 },  { 0x1d45a, 1, 1005 }, { 0x1d45b, 1, 2288 }, { 0x1d45c, 1, 14 },
    { 0x1d45d, 1, 1010 }, { 0x1d45e, 1, 2756 }, { 0x1d45f, 1, 591 },  { 0x1d460, 1, 356 },  { 0x1d461, 1, 1011 }, { 0x1d462, 1, 1012 }, { 0x1d463, 1, 1015 }, { 0x1d464, 1, 595 },  { 0x1d465, 1, 611 },  { 0x1d466, 1, 596 },
    { 0x1d467, 1, 1053 }, { ,
    { 0xff21, 1, 973 },   { 0xff22, 1, 975 },   { 0xff23, 1, 2297 },  { 0xff24, 1, 976 },   { 0xff25, 1, 977 },   { 0xff26, 1, 2322 },  { 0xff27, 1, 979 },   { 0xff28, 1, 980 },   { 0xff29, 1, 981 },   { 0xff2a, 1, 982 },
    { 0xff2b, 1, 983 },   { 0xff2c, 1, 984 },   { 0xff2d, 1, 985 },   { 0xff2e, 1, 986 },   { 0xff2f, 1, 987 },   { 0xff30, 1, 989 },   { 0xff31, 1, 2312 },  { 0xff32, 1, 990 },   { 0xff33, 1, 2754 },  { 0xff34, 1, 991 },
    { 0xff35, 1, 992 },   { 0xff36, 1, 2388 },  { 0xff37, 1, 993 },   { 0xff38, 1, 2400 },  { 0xfe4c, 2, 2264 },
    { 0xfe4d, 1, 5712 },  { 0xfe4e, 1, 5712 },  { 0xfe4f, 1, 5712 },  { 0xfe50, 1, 5702 },  { 0xfe51, 1, 5703 },  { 0xfe52, 1, 2246 },  { 0xfe54, 1, 621 },   { 0xfe55, 1, 5705 },  { 0xfe56, 1, 5707 },  { 0xfe57, 1, 5706 },
    { 0xfe58, 1, 5710 },  { 0xfe59, 1, 2286 },  { 0xfe5a, 1, 2287 },  { 0xfe5b, 1, 5713 },  { 0xfe5c, 1, 5714 },  { 0xfe5d, 1, 5715 },  { 0xfe5e, 1, 5716 },  { 0xfe5f, 1, 5727 },  { 0xfe60, 1, 5728 },  { 0xfe61, 1, 5729 },
    { 0xfe62, 1, 2283 },  { 0xfe63, 1, 5730 },  { 0xfe64, 1, 5731 },  { 0xfcdf, 3, 5017 },  { 0xfce0, 3, 5263 },  { 0xfce1, 2, 5029 },
    { 0xfce2, 2, 5266 },  { 0xfce3, 2, 5041 },  { 0xfce4, 2, 5268 },  { 0xfce5, 2, 5049 },  { 0xfce6, 2, 5280 },  { 0xfce7, 2, 5075 },  { 0xfce8, 2, 5282 },  { 0xfce9, 2, 5284 },  { 0xfcea, 2, 5286 },  { 0xfceb, 2, 5131 },
    { 0xfcec, 2, 5133 },  { 0xfced, 2, 5145 },  { 0xfcee, 2, 5169 },  { 0xfcef, 2, 5274 },  { 0xfcf0, 2, 5189 },  { 0xfcf1, 2, 5278 },  { 0xfcf2, 3, 5288 },  { 0xfcf3, 3, 5291 },  { 0xfcf4, 3, 5294 },  { 0xfcf5, 2, 5297 },
    { 0xfcf6, 2, 5299 }, ,  { 0xfc25, 2, 5087 },  { 0xfc26, 2, 5089 },  { 0xfc27, 2, 5091 },  { 0xfc28, 2, 5093 },  { 0xfc29, 2, 5095 },  { 0xfc2a, 2, 5097 },  { 0xfc2b, 2, 5099 },  { 0xfc2c, 2, 5101 },  { 0xfc2d, 2, 5103 },
    { 0xfc2e, 2, 5105 },  { 0xfc2f, 2, 5107 },  { 0xfc30, 2, 5109 },  { 0xfc31, 2, 5111 },  { 0xfc32, 2, 5113 },  { 0xfc33, 2, 5115 },  { 0xfc34, 2, 5117 },  { 0xfc35, 2, 5119 },  { 0xfc36, 2, 5121 },  { 0xfc37, 2, 5123 },
    { 0xfc38, 2, 5125 },  { 0xfc39, 2, 5127 },  { 0xfc3a, 2, 5129 },  { 0xfc3b, 2, 5131 },  { 0xfc3c, 2, 5133 },  b8, 1, 4755 },  { 0xfab9, 1, 4823 },  { 0xfaba, 1, 4702 },  { 0xfabb, 1, 4824 },  { 0xfabc, 1, 4756 },  { 0xfabd, 1, 4526 },  { 0xfabe, 1, 4825 },  { 0xfabf, 1, 4757 },  { 0xfac0, 1, 4826 },  { 0xfac1, 1, 4759 },
    { 0xfac2, 1, 4827 },  { 0xfac3, 1, 4828 },  { 0xfac4, 1, 4829 },  { 0xfac5, 1, 4830 },  { 0xfac6, 1, 4831 },  { 0xfac7, 1, 4761 },  { 0xfac8, 1, 4699 },  { 0xfac9, 1, 4832 },  { 0xfaca, 1, 4762 },  { 0xfacb, 1, 4833 },
    { 0xfacc, 1, 4763 },  { 0xfacd, 1, 4834 },  { 0xface, 1, 2986 },  { 0xfacf, 1, 4835 },  { 0xfad0,},  { 0xf99f, 1, 4589 },  { 0xf9a0, 1, 4590 },  { 0xf9a1, 1, 4544 },  { 0xf9a2, 1, 4591 },  { 0xf9a3, 1, 4592 },  { 0xf9a4, 1, 4593 },  { 0xf9a5, 1, 4594 },
    { 0xf9a6, 1, 4595 },  { 0xf9a7, 1, 4596 },  { 0xf9a8, 1, 4597 },  { 0xf9a9, 1, 4598 },  { 0xf9aa, 1, 4528 },  { 0xf9ab, 1, 4599 },  { 0xf9ac, 1, 4600 },  { 0xf9ad, 1, 4601 },  { 0xf9ae, 1, 4602 },  { 0xf9af, 1, 4603 },
    { 0xf9b0, 1, 4604 },  { 0xf9b1, 1, 4605 },  { 0xf9b2, 1, 4606 },  { 0xf9b3, 1, 4607 },  { 0xf9b4, 1, 4608 },  { 0xf9b5, 1, 4609 },  { 0xf9b6, 1, 4610 },   { 0x338e, 2, 4143 },  { 0x338f, 2, 4145 },  { 0x3390, 2, 4147 },  { 0x3391, 3, 4149 },  { 0x3392, 3, 4152 },  { 0x3393, 3, 4155 },  { 0x3394, 3, 4158 },  { 0x3395, 2, 4161 },  { 0x3396, 2, 4163 },
    { 0x3397, 2, 4165 },  { 0x3398, 2, 4167 },  { 0x3399, 2, 4169 },  { 0x339a, 2, 4171 },  { 0x339b, 2, 4173 },  { 0x339c, 2, 4175 },  { 0x339d, 2, 4177 },  { 0x339e, 2, 4179 },  { 0x339f, 3, 4181 },  { 0x33a0, 3, 4184 },
    { 0x33a1, 2, 4187 },  { 0x33a2, 3, 4189 },  { 0x33a3, 3, 4192 },  { 0x33a4, 3, 4195 },  { 0x33a5, 2, 4198 },  {, 1, 3639 },  { 0x32e8, 1, 3640 },  { 0x32e9, 1, 3641 },  { 0x32ea, 1, 3642 },  { 0x32eb, 1, 3643 },
    { 0x32ec, 1, 3644 },  { 0x32ed, 1, 3645 },  { 0x32ee, 1, 3646 },  { 0x32ef, 1, 3647 },  { 0x32f0, 1, 3648 },  { 0x32f1, 1, 3649 },  { 0x32f2, 1, 3650 },  { 0x32f3, 1, 3651 },  { 0x32f4, 1, 3652 },  { 0x32f5, 1, 3653 },
    { 0x32f6, 1, 3654 },  { 0x32f7, 1, 3655 },  { 0x32f8, 1, 3656 },  { 0x32f9, 1, 3657 },  { 0x32fa, 1, 3658 },  { 0x32fb, 1, 3659 },  { 0x32fc, 1, 3660 },  { 0x32fd, 1, 3661 },  { 0x32fe, 1, 3662 },  { 0x3300, 5  { 0x3153, 1, 3149 },  { 0x3154, 1, 3150 },  { 0x3155, 1, 3151 },  { 0x3156, 1, 3152 },  { 0x3157, 1, 3153 },  { 0x3158, 1, 3154 },  { 0x3159, 1, 3155 },  { 0x315a, 1, 3156 },  { 0x315b, 1, 3157 },  { 0x315c, 1, 3158 },
    { 0x315d, 1, 3159 },  { 0x315e, 1, 3160 },  { 0x315f, 1, 3161 },  { 0x3160, 1, 3162 },  { 0x3161, 1, 3163 },  { 0x3162, 1, 3164 },  { 0x3163, 1, 3165 },  { 0x3164, 1, 3166 },  { 0x3165, 1, 3167 },  { 0x3166, 1, 3168 },
    { 0x3167, 1, 3169 },  { 0x3168, 1, 3170 },  { 0x3169, 1, 3171 },  { 0x316a, 1, 3172 },  { { 0x2f8f, 1, 2917 },  { 0x2f90, 1, 2918 },
    { 0x2f91, 1, 2919 },  { 0x2f92, 1, 2920 },  { 0x2f93, 1, 2921 },  { 0x2f94, 1, 2922 },  { 0x2f95, 1, 2923 },  { 0x2f96, 1, 2924 },  { 0x2f97, 1, 2925 },  { 0x2f98, 1, 2926 },  { 0x2f99, 1, 2927 },  { 0x2f9a, 1, 2928 },
    { 0x2f9b, 1, 2929 },  { 0x2f9c, 1, 2930 },  { 0x2f9d, 1, 2931 },  { 0x2f9e, 1, 2932 },  { 0x2f9f, 1, 2933 },  { 0x2fa0, 1, 2934 },  { 0x2fa1, 1, 2935 },  { 0x2fa2, 1, 2936 },  { 0x2fa3, 1, 2937 },  { 0x2fa4, 1, 2938 },
    { 0x2fa5, 1, 2939 },  { 0x2fa6, 1, 2940 }, ,   { 0x2111, 1, 981 },   { 0x2112, 1, 984 },   { 0x2113, 1, 610 },   { 0x2115, 1, 986 },
    { 0x2116, 2, 2310 },  { 0x2119, 1, 989 },   { 0x211a, 1, 2312 },  { 0x211b, 1, 990 },   { 0x211c, 1, 990 },   { 0x211d, 1, 990 },   { 0x2120, 2, 2313 },  { 0x2121, 3, 2315 },  { 0x2122, 2, 2318 },  { 0x2124, 1, 2320 },
    { 0x2126, 1, 2321 },  { 0x2128, 1, 2320 },  { 0x212a, 1, 983 },   { 0x212b, 2, 34 },    { 0x212c, 1, 975 },   { 0x212d, 1, 2297 },  { 0x212f, 1, 999 },   { 0x2130, 1, 977 },   { 0x2131, 1, 2322 },  { 0x2133, 1, 985 },
  },  { 0x207f, 1, 2288 },  { 0x2080, 1, 2276 },  { 0x2081, 1, 13 },    { 0x2082, 1, 6 },     { 0x2083, 1, 7 },     { 0x2084, 1, 2277 },  { 0x2085, 1, 2278 },  { 0x2086, 1, 2279 },  { 0x2087, 1, 2280 },
    { 0x2088, 1, 2281 },  { 0x2089, 1, 2282 },  { 0x208a, 1, 2283 },  { 0x208b, 1, 2284 },  { 0x208c, 1, 2285 },  { 0x208d, 1, 2286 },  { 0x208e, 1, 2287 },  { 0x2090, 1, 3 },     { 0x2091, 1, 999 },   { 0x2092, 1, 14 },
    { 0x2093, 1, 611 },   { 0x2094, 1, 1000 },  { 0x2095, 1, 588 },   { 0x2096, 1, 1004 },  { 0x2097, 1, 610 },   {  { 0x1f0d, 3, 1674 },  { 0x1f0e, 3, 1677 },  { 0x1f0f, 3, 1680 },  { 0x1f10, 2, 1683 },  { 0x1f11, 2, 1685 },  { 0x1f12, 3, 1687 },  { 0x1f13, 3, 1690 },  { 0x1f14, 3, 1693 },  { 0x1f15, 3, 1696 },  { 0x1f18, 2, 1699 },
    { 0x1f19, 2, 1701 },  { 0x1f1a, 3, 1703 },  { 0x1f1b, 3, 1706 },  { 0x1f1c, 3, 1709 },  { 0x1f1d, 3, 1712 },  { 0x1f20, 2, 1715 },  { 0x1f21, 2, 1717 },  { 0x1f22, 3, 1719 },  { 0x1f23, 3, 1722 },  { 0x1f24, 3, 1725 },
    { 0x1f25, 3, 1728 },  { 0x1f26, 3, 1731 },  { 0x1f27, 3, 1734 },  { 0x1f28, 2, 1737 },  {},  { 0x1d4b, 1, 1001 },  { 0x1d4c, 1, 1002 },  { 0x1d4d, 1, 1003 },  { 0x1d4f, 1, 1004 },  { 0x1d50, 1, 1005 },  { 0x1d51, 1, 1006 },  { 0x1d52, 1, 14 },    { 0x1d53, 1, 1007 },
    { 0x1d54, 1, 1008 },  { 0x1d55, 1, 1009 },  { 0x1d56, 1, 1010 },  { 0x1d57, 1, 1011 },  { 0x1d58, 1, 1012 },  { 0x1d59, 1, 1013 },  { 0x1d5a, 1, 1014 },  { 0x1d5b, 1, 1015 },  { 0x1d5c, 1, 1016 },  { 0x1d5d, 1, 668 },
    { 0x1d5e, 1, 1017 },  { 0x1d5f, 1, 1018 },  { 0x1d60, 1, 671 },   { 0x1d61, 1, 1019 },  { 0x1d62, 1, 1020 },  { 0x1d63, 1, 591 },   , 394 },    { 0x1d2, 2, 396 },
    { 0x1d3, 2, 398 },    { 0x1d4, 2, 400 },    { 0x1d5, 3, 402 },    { 0x1d6, 3, 405 },    { 0x1d7, 3, 408 },    { 0x1d8, 3, 411 },    { 0x1d9, 3, 414 },    { 0x1da, 3, 417 },    { 0x1db, 3, 420 },    { 0x1dc, 3, 423 },
    { 0x1de, 3, 426 },    { 0x1df, 3, 429 },    { 0x1e0, 3, 432 },    { 0x1e1, 3, 435 },    { 0x1e2, 2, 438 },    { 0x1e3, 2, 440 },    { 0x1e6, 2, 442 },    { 0x1e7, 2, 444 },    { 0x1e8, 2, 446 },    { 0x1e9, 2, 448 },
    { 0x1ea, 2, 450 },    { 0x1eb, 2, 452 },    { 0x1ec, 3, 454 94 },
    { 0xeb, 2, 96 },      { 0xec, 2, 98 },      { 0xed, 2, 100 },     { 0xee, 2, 102 },     { 0xef, 2, 104 },     { 0xf1, 2, 106 },     { 0xf2, 2, 108 },     { 0xf3, 2, 110 },     { 0xf4, 2, 112 },     { 0xf5, 2, 114 },
    { 0xf6, 2, 116 },     { 0xf9, 2, 118 },     { 0xfa, 2, 120 },     { 0xfb, 2, 122 },     { 0xfc, 2, 124 },     { 0xfd, 2, 126 },     { 0xff, 2, 128 },     { 0x100, 2, 130 },    { 0x101, 2, 132 },    { 0x102, 2, 134 },
    { 0x103, 2, 136 },    { 0x104, 2, 138 },    { 0x105, 2, 140 },    { 0x106, 2, 142 },  E((obj), POPPLER_TYPE_MEDIA))

/* FIXME: this should be generic (PopplerSaveToCallbackFunc) */

/**
 * PopplerMediaSaveFunc:
 * @buf: (array length=count) (element-type guint8): buffer containing
 *   bytes to be written.
 * @count: number of bytes in @buf.
 * @data: (closure): user data passed to poppler_media_save_to_callback()
 * @error: GError to set on error, or %NULL
 *
 * Specifies the type of the function passed to
 * poppler_media_save_to_callback().  It is called once for each block of
 * bytes that is "written" by popplegth() const { return length; }
    long int tell();
    int seek(long int offset, int origin);
    size_t read(void *ptr, size_t unitsize, size_t count);
    size_t write(const char *ptr, size_t size, size_t fromByte);
    int cache(const std::vector<ByteRange> &ranges);

    ~CachedFile();

private:
    enum ChunkState
    {
        chunkStateNew = 0,
        chunkStateLoaded
    };

    typedef struct
    {
        ChunkState state;
        char data[CachedFileChunkSize];
    } Chunk;

    int cache(size_t offset, size_t length);ATE_NO_EXPORT POPPLER_PRIVATE_DEPRECATED
#endif

/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
#  ifndef POPPLER_PRIVATE_NO_DEPRECATED
#    define POPPLER_PRIVATE_NO_DEPRECATED
#  endif
#endif

#endif /* POPPLER_PRIVATE_EXPORT_H */
//========================================================================
//
// CharTypes.h
//
// Copyright 2001-2003 Glyph & Cog, LLC
//
//========================================================================

#ifndef CHARTYPES_H
#define CHARTt, PopplerStructureBorderStyle *border_styles);
POPPLER_PUBLIC
gboolean poppler_structure_element_get_border_thickness(PopplerStructureElement *poppler_structure_element, gdouble *border_thicknesses);
POPPLER_PUBLIC
void poppler_structure_element_get_padding(PopplerStructureElement *poppler_structure_element, gdouble *paddings);
POPPLER_PUBLIC
gboolean poppler_structure_element_get_color(PopplerStructureElement *poppler_structure_element, PopplerColor *color);

POPPLER_PUBLIC
gdouble poppler_structure_element_get_space_before(PoppleScope:
 */
typedef enum
{
    POPPLER_STRUCTURE_TABLE_SCOPE_ROW,
    POPPLER_STRUCTURE_TABLE_SCOPE_COLUMN,
    POPPLER_STRUCTURE_TABLE_SCOPE_BOTH,
} PopplerStructureTableScope;

/**
 * PopplerStructureElement:
 *
 * A #PopplerDocument structure element.
 *
 * Since 25.06 this type supports g_autoptr
 */

POPPLER_PUBLIC
GType poppler_structure_element_get_type(void) G_GNUC_CONST;
POPPLER_PUBLIC
PopplerStructureElementKind poppler_structure_element_get_kind(PopplerStructureElement *poppler_structure_element);
POPPLER_PUBLIC
gint popLEMENT_FORM,
} PopplerStructureElementKind;

/**
 * PopplerStructureGetTextFlags:
 * @POPPLER_STRUCTURE_GET_TEXT_NONE: No flags.
 * @POPPLER_STRUCTURE_GET_TEXT_RECURSIVE: For non-leaf, non-content
 *    elements, recursively obtain the text from all the elements
 *    enclosed in the subtree.
 */
typedef enum
{
    POPPLER_STRUCTURE_GET_TEXT_NONE = 0,
    POPPLER_STRUCTURE_GET_TEXT_RECURSIVE = (1 << 0),
} PopplerStructureGetTextFlags;

/**
 * PopplerStructurePlacement:
 */
typedef enum
{
    POPPLER_STRUCTURE_PLACEMENT_BLOCK,
    Poid endForm(Object * /* obj */, Ref id) override;

    void drawChar(GfxState *state, double xx, double yy, double dx, double dy, double ox, double oy, CharCode c, int nBytes, const Unicode *u, int uLen) override;

    void beginMarkedContent(const char *name, Dict *properties) override;
    void endMarkedContent(GfxState *state) override;

    const TextSpanArray &getTextSpans() const;

private:
    void endSpan();
    bool inMarkedContent() const { return !mcidStack.empty(); }
    bool contentStreamMatch();
    bool needFontChang { return ++ref; }
    int decRef() { return --ref; }

    XRef *xref; // the xref table for this PDF file
    std::vector<Object> elems; // array of elements
    std::atomic_int ref; // reference count
    mutable std::recursive_mutex mutex;
};

//------------------------------------------------------------------------
// Object Array accessors.
//------------------------------------------------------------------------

inline int Object::arrayGetLength() const
{
    OBJECT_TYPE_CHECK(objArray);
    return array->getLength();
}

ixel
    splashThinLineShape // draw line shaped at least with 1 pixel
};
// number of components in each color mode
// (defined in SplashState.cc)
extern int splashColorModeNComps[];

// max number of components in any SplashColor
constexpr std::size_t splashMaxColorComps = SPOT_NCOMPS + 4;

typedef unsigned char SplashColor[splashMaxColorComps];
typedef unsigned char *SplashColorPtr;
typedef const unsigned char *SplashColorConstPtr;

// RGB8
static inline unsigned char splashRGB8R(SplashColorPtr rgb8)
{
    return rgb8[0];
}
statipublic FilterStream
{
public:
    explicit JPXStream(Stream *strA);
    ~JPXStream() override;

    JPXStream(const JPXStream &other) = delete;
    JPXStream &operator=(const JPXStream &other) = delete;

    StreamKind getKind() const override { return strJPX; }
    [[nodiscard]] bool reset() override;
    void close() override;
    Goffset getPos() override;
    int getChar() override;
    int lookChar() override;
    std::optional<std::string> getPSFilter(int psLevel, const char *indent) override;
    bool isBinary(bool last = trr=(const PDFDocFactory &) = delete;

    // Create a PDFDoc. Returns a PDFDoc. You should check this PDFDoc
    // with PDFDoc::isOk() for failures.
    std::unique_ptr<PDFDoc> createPDFDoc(const GooString &uri, const std::optional<GooString> &ownerPassword = {}, const std::optional<GooString> &userPassword = {});

    // Extend supported URIs with the ones from the PDFDocBuilder.
    void registerPDFDocBuilder(PDFDocBuilder *pdfDocBuilder);

private:
    std::vector<PDFDocBuilder *> *builders;
};

#endif /* PDFDOCFACTORY_H */
//==td::vector<unsigned char>> readEmbFontFile(XRef *xref);

    // Get the next char from a string <s> of <len> bytes, returning the
    // char <code>, its Unicode mapping <u>, its displacement vector
    // (<dx>, <dy>), and its origin offset vector (<ox>, <oy>).  <uSize>
    // is the number of entries available in <u>, and <uLen> is set to
    // the number actually used.  Returns the number of bytes used by
    // the char code.
    virtual int getNextChar(const char *s, int len, CharCode *code, Unicode const **u, int *uLen, doubold
        W800,
        W900
    };

    // Build a GfxFont object.
    static std::unique_ptr<GfxFont> makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict);

    GfxFont(const GfxFont &) = delete;
    GfxFont &operator=(const GfxFont &other) = delete;
    virtual ~GfxFont();

    bool isOk() const { return ok; }

    // Get font tag.
    const std::string &getTag() const { return tag; }

    // Get font dictionary ID.
    const Ref *getID() const { return &id; }

    // Does this font match the tag?
    bool matches(cional>

#include "goo/GooString.h"
#include "Object.h"
#include "CharTypes.h"
#include "poppler_private_export.h"

class Dict;
class CMap;
class CharCodeToUnicode;
class FoFiTrueType;
class PSOutputDev;
struct GfxFontCIDWidths;
struct Base14FontMapEntry;
class FNVHash;

//------------------------------------------------------------------------
// GfxFontType
//------------------------------------------------------------------------

enum GfxFontType
{
    //----- Gfx8BitFont
    fontUnknownType,
    fontType1,
    fontType1C,
    flid
    int linearizationState;
    XRef *xref = nullptr;
    SecurityHandler *secHdlr = nullptr;
    Catalog *catalog = nullptr;
    Hints *hints = nullptr;
    Outline *outline = nullptr;
    std::vector<std::unique_ptr<Page>> pageCache;

    bool ok = false;
    int errCode = errNone;
    // If there is an error opening the PDF file with fopen() in the constructor,
    // then the POSIX errno will be here.
    int fopenErrno;

    Goffset startXRefPos = -1; // offset of last xref table
    mutable std::recursive_mutex mutex;
};
d writeObject(Object *obj, OutStream *outStr, XRef *xref, unsigned int numOffset, unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, Ref ref, std::set<Dict *> *alreadyWrittenDicts = nullptr);
    static void writeHeader(OutStream *outStr, int major, int minor);

    static Object createTrailerDict(int uxrefSize, bool incrUpdate, Goffset startxRef, Ref *root, XRef *xRef, const char *fileName, Goffset fileSize);
    static void writeXRefTableTrailer(Object &&trailerDict, XRef *uxref, bool writeAllEntries, Goffset uxrurn getDocInfoStringEntry("ModDate"); }

    // Return the PDF subtype, part, and conformance
    PDFSubtype getPDFSubtype() const { return pdfSubtype; }
    PDFSubtypePart getPDFSubtypePart() const { return pdfPart; }
    PDFSubtypeConformance getPDFSubtypeConformance() const { return pdfConformance; }

    // Return the PDF version specified by the file (either header or catalog).
    int getPDFMajorVersion() const { return std::max(headerPdfMajorVersion, catalog->getPDFMajorVersion()); }
    int getPDFMinorVersion() const
    {
eturn catalog->getStructTreeRoot(); }

    // Get page. First page is page 1.
    Page *getPage(int page);

    // Display a page.
    void displayPage(OutputDev *out, int page, double hDPI, double vDPI, int rotate, bool useMediaBox, bool crop, bool printing, bool (*abortCheckCbk)(void *data) = nullptr, void *abortCheckCbkData = nullptr,
                     bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr, bool copyXRef = false);

    // Display a range of pages.
        ref = fi->getRef();
        emb_ref = fi->getEmbRef();
    }

    std::string font_name;
    std::string font_file;
    font_info::type_enum type : 5;
    bool is_embedded : 1;
    bool is_subset : 1;

    Ref ref;
    Ref emb_ref;
};

class poppler::font_iterator_private
{
public:
    font_iterator_private(int start_page, document_private *dd) : font_info_scanner(dd->doc, start_page), total_pages(dd->doc->getNumPages()), current_page((std::max)(start_page, 0)) { }
    ~font_iterator_private() = default;

    FontInfoScanner fEXPORT SplashPath
{
public:
    // Create an empty path.
    SplashPath();
    ~SplashPath();

    SplashPath(const SplashPath &) = delete;
    SplashPath &operator=(const SplashPath &) = delete;
    SplashPath(SplashPath &&path) noexcept;

    // Append <path> to <this>.
    void append(SplashPath *path);

    // Start a new subpath.
    SplashError moveTo(SplashCoord x, SplashCoord y);

    // Add a line segment to the last subpath.
    SplashError lineTo(SplashCoord x, SplashCoord y);

    // Add a third-order (cubic) Bezier cureturn size(); }

    // Get C string.
    using std::string::c_str;

    // Get <i>th character.
    char getChar(size_t i) const { return (*this)[i]; }

    // Change <i>th character.
    void setChar(int i, char c) { (*this)[i] = c; }

    // Clear string to zero length.
    using std::string::clear;

    // Append a character or string.
    GooString *append(char c)
    {
        push_back(c);
        return this;
    }
    GooString *append(const GooString *str)
    {
        static_cast<std::string &>(*this).append(*str);
    ect_info;
    PublicKeyInfo public_key_info;
    Validity cert_validity;
    GooString cert_serial;
    GooString cert_der;
    GooString cert_nick;
    unsigned int ku_extensions;
    int cert_version;
    bool is_qualified;
    bool is_self_signed;
    KeyLocation keyLocation;
    CertificateType certificate_type = CertificateType::X509;
};

#endif
//========================================================================
//
// GooString.h
//
// Simple variable-length string type.
//
// Copyright 1996-2003 Glyph & Cog, LLC
//
//=;

    Links(const Links &) = delete;
    Links &operator=(const Links &) = delete;

    const std::vector<std::shared_ptr<AnnotLink>> &getLinks() const { return links; }

private:
    std::vector<std::shared_ptr<AnnotLink>> links;
};

#endif
prefix=/usr
libdir=/usr/lib
includedir=/usr/include

Name: poppler-glib
Description: GLib wrapper for poppler
Version: 25.08.0
Requires: glib-2.0 >= 2.72 gobject-2.0 >= 2.72 cairo >= 1.16.0 
Requires.private: poppler = 25.08.0

Libs: -L${libdir} -lpoppler-glib
Cflags: -I${includedir}/poppler/gqualified name of the target
    //    field.
    // b) An indirect reference to an annotation dictionary.
    // c) An array of "such dictionaries or text strings".
    //
    // While b / c appear to be very uncommon and can't easily be
    // created with Adobe Acrobat DC. So only support hide
    // actions with named targets (yet).
    bool hasTargetName() const { return hasTargetNameFlag; }
    const std::string &getTargetName() const { return targetName; }

    // Should this action show or hide.
    bool isShowAction() cons----------------------------

class LinkLaunch : public LinkAction
{
public:
    // Build a LinkLaunch from an action dictionary.
    explicit LinkLaunch(const Object *actionObj);
    ~LinkLaunch() override;

    // Was the LinkLaunch created successfully?
    bool isOk() const override { return fileName != nullptr; }

    // Accessors.
    LinkActionKind getKind() const override { return actionLaunch; }
    const GooString *getFileName() const { return fileName.get(); }
    const GooString *getParams() const { return params.get();ort.h"
#include <memory>
#include <optional>
#include <set>

class GooString;
class Array;
class Dict;
class Sound;
class MediaRendition;
class AnnotLink;
class Annots;

//------------------------------------------------------------------------
// LinkAction
//------------------------------------------------------------------------

enum LinkActionKind
{
    actionGoTo, // go to destination
    actionGoToR, // go to destination in new file
    actionLaunch, // launch app (or open document)
    actionURI, // URI
    actionNamed, // // Get stream.
    Stream *getStream() { return lexer.getStream(); }

    // Get current position in file.
    Goffset getPos() { return lexer.getPos(); }

private:
    Lexer lexer; // input stream
    bool allowStreams; // parse stream objects?
    Object buf1, buf2; // next two tokens
    int inlineImg; // set when inline image data is encountered

    Stream *makeStream(Object &&dict, const unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, int recursion, bool strict);
    void shift(int iaWindowType type; // movieWindowEmbedded

    int width; // -1
    int height; // -1

    // floating window position
    MediaWindowRelativeTo relativeTo; // windowRelativeToDocument (or to desktop)
    double XPosition; // 0.5
    double YPosition; // 0.5

    bool hasTitleBar; // true
    bool hasCloseButton; // true
    bool isResizeable; // true
};

struct MediaParameters
{

    MediaParameters();
    ~MediaParameters() = default;

    // parse from a "Media Play Parameters" dictionary
    void parseMediaPlayParameters(ObjectFileID> idA, SplashFontSrc *srcA);

    std::unique_ptr<SplashFontFileID> id;
    SplashFontSrc *src;
    int refCnt;

    friend class SplashFontEngine;
};

#endif

#ifndef POPPLER_CPP_EXPORT_H
#define POPPLER_CPP_EXPORT_H

#ifdef POPPLER_CPP_STATIC_DEFINE
#  define POPPLER_CPP_EXPORT
#  define POPPLER_CPP_NO_EXPORT
#else
#  ifndef POPPLER_CPP_EXPORT
#    ifdef poppler_cpp_EXPORTS
        /* We are building this library */
#      define POPPLER_CPP_EXPORT __attribute__((visibility("default")))
#    else
        /* We are using thibj, Dict *dict);
    ~PostScriptFunction() override;
    std::unique_ptr<Function> copy() const override { return std::make_unique<PostScriptFunction>(this); }
    Type getType() const override { return Type::PostScript; }
    void transform(const double *in, double *out) const override;
    bool isOk() const override { return ok; }

    const GooString *getCodeString() const { return codeString.get(); }

    explicit PostScriptFunction(const PostScriptFunction *func, PrivateTag = {});

private:
    bool parseCode(Stream *str, int  }
    double getRangeMax(int i) const { return range[i][1]; }
    bool getHasRange() const { return hasRange; }
    virtual bool hasDifferentResultSet(const Function *func) const { return false; }

    // Transform an input tuple into an output tuple.
    virtual void transform(const double *in, double *out) const = 0;

    virtual bool isOk() const = 0;

protected:
    static std::unique_ptr<Function> parse(Object *funcObj, std::set<int> *usedParents);

    explicit Function(const Function *func);

    int m, n; // size of input de "CachedFile.h"

#include <cstdio>

class POPPLER_PRIVATE_EXPORT FILECacheLoader : public CachedFileLoader
{
    FILE *file = stdin;

public:
    FILECacheLoader() = default;
    ~FILECacheLoader() override;

    explicit FILECacheLoader(FILE *fileA) : file(fileA) { }

    size_t init(CachedFile *cachedFile) override;
    int load(const std::vector<ByteRange> &ranges, CachedFileWriter *writer) override;
};

#endif
/* poppler-movie.h: glib interface to Movie
 *
 * Copyright (C) 2010 Carlos Garcia Campos <carlosgc@gnome.org>
 * Copyright (C) 2006 Kristian HÃ¸gsberg <krh@redhat.com>
// Copyright (C) 2009, 2011, 2012, 2017, 2018, 2021, 2022 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com>
// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com>
// Copyright (C) 2014 Peter Breitenlohner <peb@mppmu.mpg.de>
// Copyright (C) 2017 Christoph Cullmann <cullmann@kde.org>
// Copyright (C) 2017 Thomasgchar *text);
POPPLER_PUBLIC
void poppler_set_nss_password_callback(PopplerNssPasswordFunc func);

G_END_DECLS

G_DEFINE_AUTOPTR_CLEANUP_FUNC(PopplerFormField, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PopplerSignatureInfo, poppler_signature_info_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PopplerSigningData, poppler_signing_data_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PopplerCertificateInfo, poppler_certificate_info_free)

#endif /* __POPPLER_FORM_FIELD_H__ */
/* poppler-features.h: glib interface to poppler
 * Copyright (C) 2006, Red Hatoppler_signing_data_free(PopplerSigningData *signing_data);
POPPLER_PUBLIC
void poppler_signing_data_set_destination_filename(PopplerSigningData *signing_data, const gchar *filename);
POPPLER_PUBLIC
const gchar *poppler_signing_data_get_destination_filename(const PopplerSigningData *signing_data);
POPPLER_PUBLIC
void poppler_signing_data_set_certificate_info(PopplerSigningData *signing_data, const PopplerCertificateInfo *certificate_info);
POPPLER_PUBLIC
const PopplerCertificateInfo *poppler_signing_data_get_certificate_info(const verified
 *
 * Signature certificate verification results
 *
 * Since: 21.12.0
 */
typedef enum
{
    POPPLER_CERTIFICATE_TRUSTED,
    POPPLER_CERTIFICATE_UNTRUSTED_ISSUER,
    POPPLER_CERTIFICATE_UNKNOWN_ISSUER,
    POPPLER_CERTIFICATE_REVOKED,
    POPPLER_CERTIFICATE_EXPIRED,
    POPPLER_CERTIFICATE_GENERIC_ERROR,
    POPPLER_CERTIFICATE_NOT_VERIFIED
} PopplerCertificateStatus;

/**
 * PopplerSignatureValidationFlags
 * @POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE: Whether to validate also the certificate of the signatSA.
 */

#ifndef __POPPLER_FORM_FIELD_H__
#define __POPPLER_FORM_FIELD_H__

#include <glib-object.h>
#include "poppler.h"

G_BEGIN_DECLS

#define POPPLER_TYPE_FORM_FIELD (poppler_form_field_get_type())
#define POPPLER_FORM_FIELD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_FORM_FIELD, PopplerFormField))
#define POPPLER_IS_FORM_FIELD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_FORM_FIELD))

/**
 * PopplerSignatureStatus
 * @POPPLER_SIGNATURE_VALID: signature is cryptographically valid
 * @POPPLER_SIGNATURE_INVALID: ST;
#define POPPLER_TYPE_MOVIE_PLAY_MODE (poppler_movie_play_mode_get_type ())

/* enumerations from "poppler-structure-element.h" */
POPPLER_PUBLIC
GType poppler_structure_element_kind_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_ELEMENT_KIND (poppler_structure_element_kind_get_type ())
POPPLER_PUBLIC
GType poppler_structure_get_text_flags_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_STRUCTURE_GET_TEXT_FLAGS (poppler_structure_get_text_flags_get_type ())
POPPLER_PUBLIC
GType poppler_structure_placement_get_tyLIC
GType poppler_dest_type_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_DEST_TYPE (poppler_dest_type_get_type ())
POPPLER_PUBLIC
GType poppler_action_movie_operation_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_ACTION_MOVIE_OPERATION (poppler_action_movie_operation_get_type ())
POPPLER_PUBLIC
GType poppler_action_layer_action_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_ACTION_LAYER_ACTION (poppler_action_layer_action_get_type ())

/* enumerations from "poppler-annot.h" */
POPPLER_PUBLIC
GType poppler_annot_type_eing drawn
    std::set<int> charProcDrawing; // the charProc that are being drawn

    bool // callback to check for an abort
            (*abortCheckCbk)(void *data);
    void *abortCheckCbkData;

    static const Operator opTab[]; // table of operators

    void go(bool topLevel);
    void execOp(Object *cmd, Object args[], int numArgs);
    const Operator *findOp(const char *name);
    bool checkArg(Object *arg, TchkType type);
    Goffset getPos();

    int bottomGuard();

    // graphics state operators
    void opSave(Object'Urso <fabiodurso@hotmail.it>
// 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
// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
// Copyright (C) 2019, 2022, 2024 Oliver Sander <oliver.sander@tu-dresden.de>
// Copyright (C) 2019 Volker Krause <vkrause@kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//=getWidth() const { return width; }
    // Returns the height of the image
    int getHeight() const { return height; }

    // Removes the created Image XObject as well as its soft mask from the XRef Table
    void removeAnnotStampImageObject();

private:
    void initialize(PDFDoc *docA, int widthA, int heightA, ColorSpace colorSpace, int bitsPerComponent, char *data, int dataLength);

    PDFDoc *doc;

    Object imgObj;
    Ref ref;
    Ref sMaskRef;

    int width;
    int height;
};

#endif
/*
 * Copyright (C) 2009-2010, Pino , 0, 0, 0, 0x1ff6, 0x1ff3, 0, 0 },
    { 0x1fd2, 0x0390, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1fd7, 0, 0, 0 },
    { 0x1fe2, 0x03b0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1fe7, 0, 0, 0 },
    { 0, 0x03d3, 0, 0, 0, 0, 0, 0x03d4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0x04d0, 0, 0x04d2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0x0400, 0, 0, 0, 0, 0x04d6, 0, 0x0401, 0,  { 0x1edd, 0x1edb, 0, 0x1ee1, 0, 0, 0, 0, 0x1edf, 0, 0, 0, 0, 0, 0, 0, 0, 0x1ee3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0x1eea, 0x1ee8, 0, 0x1eee, 0, 0, 0, 0, 0x1eec, 0, 0, 0, 0, 0, 0, 0, 0, 0x1ef0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0x1eeb, 0x1ee9, 0, 0x1eef, 0, 0, 0, 0, 0x1eed, 0, 0, 0, 0, 0, 0, 0, 0, 0x1ef1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0x1fba, 0x0386, 0, 0, 0x1fb9, 0x1fb8, 0, 0, 0, 0, 0, 0, 0, 0, 0x1f08, 0x1f09, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1fbc, 0, 0 },
    { 0x1fc8, 0x0388, 0, 0 0 },
    { 0x1ef2, 0x00dd, 0x0176, 0x1ef8, 0x0232, 0, 0x1e8e, 0x0178, 0x1ef6, 0, 0, 0, 0, 0, 0, 0, 0, 0x1ef4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0x0179, 0x1e90, 0, 0, 0, 0x017b, 0, 0, 0, 0, 0x017d, 0, 0, 0, 0, 0, 0x1e92, 0, 0, 0, 0, 0, 0, 0, 0, 0x1e94, 0, 0, 0, 0 },
    { 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x0101, 0x0103, 0x0227, 0x00e4, 0x1ea3, 0x00e5, 0, 0x01ce, 0x0201, 0x0203, 0, 0, 0, 0x1ea1, 0, 0x1e01, 0, 0, 0x0105, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0x1e03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1e05, 0, d3 }, { 0x0654, 0x06c0 }, { 0x093c, 0x0929 }, { 0x093c, 0x0931 }, { 0x093c, 0x0934 }, { 0x0bd7, 0x0b94 }, { 0x0bbe, 0x0bcb }, { 0x0c56, 0x0c48 }, { 0x0cd5, 0x0cc0 }, { 0x0cd5, 0x0ccb }, { 0x0d3e, 0x0d4b },
    { 0x0dca, 0x0ddd }, { 0x102e, 0x1026 }, { 0x0304, 0x1e38 }, { 0x0304, 0x1e39 }, { 0x0304, 0x1e5c }, { 0x0304, 0x1e5d }, { 0x0307, 0x1e68 }, { 0x0307, 0x1e69 }, { 0x0302, 0x1ec6 }, { 0x0302, 0x1ec7 }, { 0x0302, 0x1ed8 },
    { 0x0302, 0x1ed9 }, { 0x0345, 0x1f82 }, { 0x0345, 0x1f83 }, { 0x0345, 0x1f84 }, { 0x0345, 0x1f85 }, { 0, 0, 345, 0,   346, 0,   347, 0, 348, 0, 0,   349, 0,   350, 0,   351, 0,   0, 0, 0,   0,   0,   142,
      0,   0,   143, 0, 0, 144, 0, 0,   145, 0, 0,   146, 0, 0,   0, 0,   0,   0,   0,   0,   0, 0,   0, 0,   0, 0,   0, 0,   0, 0,   0, 352, 353, 354, 355, 0,   0, 0,   0, 0,   0,   0,   0,   0,   0,   356, 0, 0 }
};

static const short compose_table[COMPOSE_TABLE_LAST + 1] = {
    0 /* page 0 */,
    1 /* page 1 */,
    2 /* page 2 */,
    3 /* page 3 */,
    4 /* page 4 */,
    0 + UNICODE_MAX_TABLE_INDEX,
    5 /* page 6 */,
  , 0, 0, 0, 0,
      0, 212, 0, 0, 0, 0, 0, 0, 0,   0, 0,   0, 0, 0, 0, 0, 0, 0, 213, 0,   0,   214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { /* page 9, index 6 */
      0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 217, 0, 0,, 0,   0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0,   0,   0,   0, 0, 0, 0, 0,   0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { /* page 3, index 3 */
      357, 358, 359, 360, 361, 0,   362, 363, 364, 365, 366, 367, 368, 0,  0,   369, 0,   370, 0,   371, 372, 0,  0, 0, 0, 0,  0, 373, 0, 0,  0, 0, 0, 0, 0, 374, 375, 376, 377, 378, 379, 0,  0, 0, 0, 380, 381, 0,  382, 383, 0,   0,
   egenerated from gen-unicode-tables.pl, also in GLib, with relevant
// Unicode data tables from ftp.unicode.org.

#include "UnicodeTypeTable.h"

#define COMPOSE_FIRST_START 1
#define COMPOSE_FIRST_SINGLE_START 147
#define COMPOSE_SECOND_START 357
#define COMPOSE_SECOND_SINGLE_START 388

#define COMPOSE_TABLE_LAST 48

static const unsigned short compose_data[][256] = {
    { /* page 0, index 0 */
      0,  0,  0,  0,  0,  0,  0,   0,  0,   0,   0,   0,  0,  0,  0,  0,  0,  0,  0,   0, 0,   0,   0,   0,   0,  0,  0,  0,  0,  0, 0,  0,
PopplerAction *poppler_index_iter_get_action(PopplerIndexIter *iter);
POPPLER_PUBLIC
gboolean poppler_index_iter_next(PopplerIndexIter *iter);

#define POPPLER_TYPE_FONT_INFO (poppler_font_info_get_type())
#define POPPLER_FONT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_FONT_INFO, PopplerFontInfo))
#define POPPLER_IS_FONT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_FONT_INFO))
POPPLER_PUBLIC
GType poppler_font_info_get_type(void) G_GNUC_CONST;
POPPLER_PUBLIC
PopplerFontInfo *poppler_font_info_new(Poppleent *document, int fd, gboolean include_changes, GError **error);
#endif
POPPLER_PUBLIC
gboolean poppler_document_get_id(PopplerDocument *document, gchar **permanent_id, gchar **update_id);
POPPLER_PUBLIC
int poppler_document_get_n_pages(PopplerDocument *document);
POPPLER_PUBLIC
PopplerPage *poppler_document_get_page(PopplerDocument *document, int index);
POPPLER_PUBLIC
PopplerPage *poppler_document_get_page_by_label(PopplerDocument *document, const char *label);
POPPLER_PUBLIC
gchar *poppler_document_get_pdf_version_string(PoppleIONS_OK_TO_ADD_NOTES | POPPLER_PERMISSIONS_OK_TO_FILL_FORM | POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS | POPPLER_PERMISSIONS_OK_TO_ASSEMBLE | POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION)

} PopplerPermissions;
/* clang-format on */

/**
 * PopplerPDFSubtype:
 * @POPPLER_PDF_SUBTYPE_UNSET: Null
 * @POPPLER_PDF_SUBTYPE_PDF_A: ISO 19005 - Document management -- Electronic document file format for long-term preservation (PDF/A)
 * @POPPLER_PDF_SUBTYPE_PDF_E: ISO 24517 - Document management -- Engineering document format using PDF : attachments panel visible
 *
 * Page modes
 */
typedef enum
{
    POPPLER_PAGE_MODE_UNSET,
    POPPLER_PAGE_MODE_NONE,
    POPPLER_PAGE_MODE_USE_OUTLINES,
    POPPLER_PAGE_MODE_USE_THUMBS,
    POPPLER_PAGE_MODE_FULL_SCREEN,
    POPPLER_PAGE_MODE_USE_OC,
    POPPLER_PAGE_MODE_USE_ATTACHMENTS
} PopplerPageMode;

/**
 * PopplerFontType:
 * @POPPLER_FONT_TYPE_UNKNOWN: unknown font type
 * @POPPLER_FONT_TYPE_TYPE1: Type 1 font type
 * @POPPLER_FONT_TYPE_TYPE1C: Type 1 font type embedded in Compact Font Format (CFF) font program
 * @PO reference for a page object.
    Ref *getPageRef(int i);

    // Return base URI, or NULL if none.
    const std::optional<std::string> &getBaseURI() const { return baseURI; }

    // Return the contents of the metadata stream, or NULL if there is
    // no metadata.
    std::unique_ptr<GooString> readMetadata();

    // Return the structure tree root object.
    StructTreeRoot *getStructTreeRoot();

    // Return values from the MarkInfo dictionary as flags in a bitfield.
    enum MarkInfoFlags
    {
        markInfoNull = 1 << 0lookup(const GooString *name);
    int numEntries() { return entries.size(); };
    // iterator accessor, note it returns a pointer to the internal object, do not free nor delete it
    Object *getValue(int i);
    const GooString *getName(int i) const;

private:
    struct Entry
    {
        Entry(Array *array, int index);
        ~Entry();
        GooString name;
        Object value;
    };

    void parse(const Object *tree, RefRecursionChecker &seen);

    XRef *xref;
    std::vector<std::unique_ptr<Entry>> entries;
};

//---ashSqrt(dx * dx + dy * dy);
}

static inline bool splashCheckDet(SplashCoord m11, SplashCoord m12, SplashCoord m21, SplashCoord m22, SplashCoord epsilon)
{
    return fabs(m11 * m22 - m12 * m21) >= epsilon;
}

#endif
/*
 * Copyright (C) 2009, Pino Toscano <pino@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is disthar *r = static_cast<char *>(gmalloc(n + 1, false));
    r[n] = '\0';
    return std::strncpy(r, s, n);
}

#endif // GMEM_H
//========================================================================
//
// CurlPDFDocBuilder.h
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
// Copyright 2010, 2018, 2022 Albert Astals Cid <aacid@kde.org>
// Copyright 2021 Oliver Sander <oliver.sander@tu-dresden.de>
// Copyright 2025 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk>
//
//;
    int bytes;
    if (width < 0 || height < 0 || size <= 0 || checkedMultiply(width, height, &count) || checkedMultiply(count, size, &bytes)) {
        std::fputs("Bogus memory allocation size\n", stderr);

        if (checkoverflow) {
            return nullptr;
        }

        std::abort();
    }

    return gmalloc(bytes, checkoverflow);
}

inline void *greallocn(void *p, int count, int size, bool checkoverflow = false, bool free_p = true)
{
    if (count == 0) {
        if (free_p) {
            gfree(p);
        }
      e1C> make(std::span<unsigned char> data);

    // Create a FoFiType1C object from a file on disk.
    static std::unique_ptr<FoFiType1C> load(const char *fileName);

    ~FoFiType1C() override;

    // Return the font name.
    const char *getName() const;

    // Return the encoding, as an array of 256 names (any of which may
    // be NULL).  This is only useful with 8-bit fonts.
    char **getEncoding() const;

    // Get the glyph names.
    int getNumGlyphs() const { return nGlyphs; }
    GooString *getGlyphName(int gid) constget_type())
#define POPPLER_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_LAYER, PopplerLayer))
#define POPPLER_IS_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_LAYER))

/**
 * PopplerLayer:
 *
 * A #PopplerDocument layer.
 *
 * Since 25.06 this type supports g_autoptr
 */

POPPLER_PUBLIC
GType poppler_layer_get_type(void) G_GNUC_CONST;

POPPLER_PUBLIC
const gchar *poppler_layer_get_title(PopplerLayer *layer);
POPPLER_PUBLIC
gboolean poppler_layer_is_visible(PopplerLayer *layer);
POPPLER_PUBLIC
void popple0xf8e7, 0xbd, 1 }, { 0xf8e8, 0xf8ea, 0xe2, 1 }, { 0xf8eb, 0xf8f4, 0xe6, 1 }, { 0xf8f5, 0xf8f5, 0xf4, 1 },
    { 0xf8f6, 0xf8fe, 0xf6, 1 }
};
#define symbolUnicodeMapLen (sizeof(symbolUnicodeMapRanges) / sizeof(UnicodeMapRange))

static const UnicodeMapRange zapfDingbatsUnicodeMapRanges[] = { { 0x0020, 0x0020, 0x20, 1 }, { 0x2192, 0x2192, 0xd5, 1 }, { 0x2194, 0x2195, 0xd6, 1 }, { 0x2460, 0x2469, 0xac, 1 }, { 0x25a0, 0x25a0, 0x6e, 1 }, { 0x25b2, 0x25b2, 0x73, 1 },
                                                                { 0x25  { 0xf7ff, 0xf7ff, 0x59, 1 },  { 0xfb00, 0xfb00, 0x6666, 2 }, { 0xfb01, 0xfb01, 0x6669, 2 }, { 0xfb02, 0xfb02, 0x666c, 2 },
    { 0xfb03, 0xfb03, 0x666669, 3 }, { 0xfb04, 0xfb04, 0x66666c, 3 }, { 0xfb05, 0xfb05, 0x7374, 2 },   { 0xfb06, 0xfb06, 0x7374, 2 }
};
#define latin1UnicodeMapLen (sizeof(latin1UnicodeMapRanges) / sizeof(UnicodeMapRange))

static const UnicodeMapRange ascii7UnicodeMapRanges[] = {
    { 0x000a, 0x000a, 0x0a, 1 },   { 0x000c, 0x000d, 0x0c, 1 },     { 0x0020, 0x005f, 0x20, 1 },     { 0x0061, 0x007e, 0x61, 1 }, ===============================================

//========================================================================
//
// Modified under the Poppler project - http://poppler.freedesktop.org
//
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
// Copyright (C) 2019 Volker Krause <vkrause@kde.org>
// Copyright (C) 2024 Albert Astals Cid <aacid@kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make Cha;

    enum class form_type
    {
        none,
        acro,
        xfa
    };

    ~document();

    bool is_locked() const;
    bool unlock(const std::string &owner_password, const std::string &user_password);

    page_mode_enum page_mode() const;
    page_layout_enum page_layout() const;
    void get_pdf_version(int *major, int *minor) const;
    std::vector<std::string> info_keys() const;

    ustring info_key(const std::string &key) const;
    bool set_info_key(const std::string &key, const ustring &val);

    [[deprecated] actionOpenPage, ///< Performed when opening the page
        actionClosePage, ///< Performed when closing the page
    };

    std::unique_ptr<LinkAction> getAdditionalAction(PageAdditionalActionsType type);

    std::unique_ptr<Gfx> createGfx(OutputDev *out, double hDPI, double vDPI, int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, bool (*abortCheckCbk)(void *data), void *abortCheckCbkData,
                                   XRef *xrefA = nullptr);

    // Display a page.
    void display(O-------

class POPPLER_PRIVATE_EXPORT Page
{
public:
    // Constructor.
    Page(PDFDoc *docA, int numA, Object &&pageDict, Ref pageRefA, std::unique_ptr<PageAttrs> attrsA, Form *form);

    // Destructor.
    ~Page();

    Page(const Page &) = delete;
    Page &operator=(const Page &) = delete;

    // Is page valid?
    bool isOk() const { return ok; }

    // Get page parameters.
    int getNum() const { return num; }
    const PDFRectangle *getMediaBox() const { return attrs->getMediaBox(); }
    const PDFRectangle *getCropBoxis distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef PAGE_TRANSITION_H
#define PAGE_TRANSITION_H

#include "Object.h"

//-------- Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2018 Martin Packman <gzlist@googlemail.com>
//
//========================================================================

#ifndef JPEGWRITER_H
#define JPEGWRITER_H

#include "poppler-config.h"
#include "poppler_private_export.h"

#ifdef ENABLE_LIBJPEG

#    include <