1 // Copyright 2019 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PUBLIC_FPDF_THUMBNAIL_H_
6 #define PUBLIC_FPDF_THUMBNAIL_H_
7 
8 #include <stdint.h>
9 
10 // NOLINTNEXTLINE(build/include)
11 #include "fpdfview.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 // Experimental API.
18 // Gets the decoded data from the thumbnail of |page| if it exists.
19 // This only modifies |buffer| if |buflen| less than or equal to the
20 // size of the decoded data. Returns the size of the decoded
21 // data or 0 if thumbnail DNE. Optional, pass null to just retrieve
22 // the size of the buffer needed.
23 //
24 //   page    - handle to a page.
25 //   buffer  - buffer for holding the decoded image data.
26 //   buflen  - length of the buffer in bytes.
27 FPDF_EXPORT unsigned long FPDF_CALLCONV
28 FPDFPage_GetDecodedThumbnailData(FPDF_PAGE page,
29                                  void* buffer,
30                                  unsigned long buflen);
31 
32 // Experimental API.
33 // Gets the raw data from the thumbnail of |page| if it exists.
34 // This only modifies |buffer| if |buflen| is less than or equal to
35 // the size of the raw data. Returns the size of the raw data or 0
36 // if thumbnail DNE. Optional, pass null to just retrieve the size
37 // of the buffer needed.
38 //
39 //   page    - handle to a page.
40 //   buffer  - buffer for holding the raw image data.
41 //   buflen  - length of the buffer in bytes.
42 FPDF_EXPORT unsigned long FPDF_CALLCONV
43 FPDFPage_GetRawThumbnailData(FPDF_PAGE page,
44                              void* buffer,
45                              unsigned long buflen);
46 
47 // Experimental API.
48 // Returns the thumbnail of |page| as a FPDF_BITMAP. Returns a nullptr
49 // if unable to access the thumbnail's stream.
50 //
51 //   page - handle to a page.
52 FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
53 FPDFPage_GetThumbnailAsBitmap(FPDF_PAGE page);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif  // PUBLIC_FPDF_THUMBNAIL_H_
60