xref: /aosp_15_r20/external/pdfium/samples/helpers/write.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2018 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 #ifndef SAMPLES_HELPERS_WRITE_H_
6 #define SAMPLES_HELPERS_WRITE_H_
7 
8 #include <memory>
9 #include <string>
10 
11 #include "public/fpdfview.h"
12 
13 #ifdef PDF_ENABLE_SKIA
14 class SkPicture;
15 class SkWStream;
16 #endif  // PDF_ENABLE_SKIA
17 
18 std::string WritePpm(const char* pdf_name,
19                      int num,
20                      void* buffer_void,
21                      int stride,
22                      int width,
23                      int height);
24 void WriteText(FPDF_TEXTPAGE textpage, const char* pdf_name, int num);
25 void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num);
26 std::string WritePng(const char* pdf_name,
27                      int num,
28                      void* buffer,
29                      int stride,
30                      int width,
31                      int height);
32 
33 #ifdef _WIN32
34 std::string WriteBmp(const char* pdf_name,
35                      int num,
36                      void* buffer,
37                      int stride,
38                      int width,
39                      int height);
40 void WriteEmf(FPDF_PAGE page, const char* pdf_name, int num);
41 void WritePS(FPDF_PAGE page, const char* pdf_name, int num);
42 #endif  // _WIN32
43 
44 #ifdef PDF_ENABLE_SKIA
45 std::unique_ptr<SkWStream> WriteToSkWStream(const std::string& pdf_name,
46                                             int num,
47                                             const std::string& extension);
48 std::unique_ptr<SkWStream> WriteToSkWStream(const std::string& pdf_name,
49                                             int num,
50                                             const std::string& extension,
51                                             std::string& filename);
52 std::string WriteSkp(const char* pdf_name, int num, const SkPicture& picture);
53 #endif  // PDF_ENABLE_SKIA
54 
55 void WriteAttachments(FPDF_DOCUMENT doc, const std::string& name);
56 void WriteImages(FPDF_PAGE page, const char* pdf_name, int page_num);
57 void WriteRenderedImages(FPDF_DOCUMENT doc,
58                          FPDF_PAGE page,
59                          const char* pdf_name,
60                          int page_num);
61 void WriteDecodedThumbnailStream(FPDF_PAGE page,
62                                  const char* pdf_name,
63                                  int page_num);
64 void WriteRawThumbnailStream(FPDF_PAGE page,
65                              const char* pdf_name,
66                              int page_num);
67 void WriteThumbnail(FPDF_PAGE page, const char* pdf_name, int page_num);
68 
69 #endif  // SAMPLES_HELPERS_WRITE_H_
70