Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
simple_no_v8.c
Go to the documentation of this file.
1// Copyright 2020 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// No-frills example of how to initialize and call into a PDFium environment,
6// from C. The PDFium API is compatible with C (the C++ internals are hidden
7// beneath it).
8
9#include <string.h>
10
11#include "public/fpdf_edit.h"
12#include "public/fpdf_formfill.h"
13#include "public/fpdfview.h"
14
15int main(int argc, const char* argv[]) {
16 // The PDF library must be initialized before creating a document.
17 FPDF_LIBRARY_CONFIG config;
18 memset(&config, 0, sizeof(config));
19 config.version = 3;
21
22 // The document must be created before creating a form-fill environment.
23 // Typically use FPDF_LoadDocument() for pre-existing documents. Here, we
24 // create a new blank document for simplicity.
25 FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
26
27 FPDF_FORMFILLINFO formfillinfo;
28 memset(&formfillinfo, 0, sizeof(formfillinfo));
29 formfillinfo.version = 1;
30
31 FPDF_FORMHANDLE form_handle =
33
34 // Typically use FPDF_LoadPage() for pre-existing pages. Here, we
35 // create a new blank page for simplicity.
36 FPDF_PAGE page = FPDFPage_New(doc, 0, 640.0, 480.0);
37 FORM_OnAfterLoadPage(page, form_handle);
39
40 // Do actual work with the page here.
41
43 FORM_OnBeforeClosePage(page, form_handle);
45
50
51 return 0;
52}
FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height)
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument()
#define FPDFDOC_AACTION_WC
FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle)
FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle)
#define FPDFPAGE_AACTION_CLOSE
FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType)
FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType)
FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, FPDF_FORMFILLINFO *formInfo)
FPDF_EXPORT void FPDF_CALLCONV FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle)
#define FPDFPAGE_AACTION_OPEN
FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary()
FPDF_EXPORT void FPDF_CALLCONV FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG *config)
FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document)
FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page)
int main(int argc, const char *argv[])