5#include "samples/helpers/write.h"
14#include "public/cpp/fpdf_scopers.h"
15#include "public/fpdf_annot.h"
16#include "public/fpdf_attachment.h"
17#include "public/fpdf_edit.h"
18#include "public/fpdf_thumbnail.h"
19#include "testing/fx_string_testhelpers.h"
20#include "testing/image_diff/image_diff_png.h"
21#include "third_party/base/notreached.h"
24#include "third_party/skia/include/core/SkPicture.h"
25#include "third_party/skia/include/core/SkSerialProcs.h"
26#include "third_party/skia/include/core/SkStream.h"
27#include "third_party/skia/include/encode/SkPngEncoder.h"
32bool CheckDimensions(
int stride,
int width,
int height) {
33 if (stride < 0 || width < 0 || height < 0) {
36 if (height > 0 && stride > INT_MAX / height) {
42const char* AnnotSubtypeToCString(FPDF_ANNOTATION_SUBTYPE subtype) {
92 return "FileAttachment";
107 return "PrinterMark";
124 NOTREACHED_NORETURN();
127void AppendFlagString(
const char* flag,
std::string* output) {
128 if (!output->empty()) {
134std::string AnnotFlagsToString(
int flags) {
137 AppendFlagString(
"Invisible", &str);
140 AppendFlagString(
"Hidden", &str);
143 AppendFlagString(
"Print", &str);
146 AppendFlagString(
"NoZoom", &str);
149 AppendFlagString(
"NoRotate", &str);
152 AppendFlagString(
"NoView", &str);
155 AppendFlagString(
"ReadOnly", &str);
158 AppendFlagString(
"Locked", &str);
161 AppendFlagString(
"ToggleNoView", &str);
166const char* PageObjectTypeToCString(
int type) {
182 NOTREACHED_NORETURN();
185std::vector<uint8_t> EncodePng(pdfium::span<
const uint8_t> input,
190 std::vector<uint8_t> png;
195 png = image_diff_png::EncodeGrayPNG(input, width, height, stride);
198 png = image_diff_png::EncodeBGRPNG(input, width, height, stride);
201 png = image_diff_png::EncodeBGRAPNG(input, width, height, stride,
205 png = image_diff_png::EncodeBGRAPNG(input, width, height, stride,
209 NOTREACHED_NORETURN();
215int CALLBACK EnhMetaFileProc(HDC hdc,
216 HANDLETABLE* handle_table,
217 const ENHMETARECORD* record,
220 std::vector<
const ENHMETARECORD*>& items =
221 *
reinterpret_cast<std::vector<
const ENHMETARECORD*>*>(param);
222 items.push_back(record);
227std::string GeneratePageOutputFilename(
const char* pdf_name,
229 const char* extension) {
230 std::ostringstream stream;
231 stream << pdf_name <<
"." << page_num <<
"." << extension;
232 std::string filename = stream.str();
233 if (filename.size() >= 256) {
234 fprintf(stderr,
"Filename %s is too long\n", filename.c_str());
235 return std::string();
241std::string GenerateImageOutputFilename(
const char* pdf_name,
244 const char* extension) {
245 std::ostringstream stream;
246 stream << pdf_name <<
"." << page_num <<
"." << image_num <<
"." << extension;
247 std::string filename = stream.str();
248 if (filename.size() >= 256) {
249 fprintf(stderr,
"Filename %s for saving image is too long.\n",
251 return std::string();
265 if (!CheckDimensions(stride, width, height)) {
269 int out_len = width * height;
270 if (out_len > INT_MAX / 3) {
276 std::string filename = GeneratePageOutputFilename(pdf_name, num,
"ppm");
277 if (filename.empty()) {
278 return std::string();
280 FILE* fp = fopen(filename.c_str(),
"wb");
282 return std::string();
285 fprintf(fp,
"P6\n# PDF test render\n%d %d\n255\n", width, height);
288 const uint8_t* buffer =
reinterpret_cast<
const uint8_t*>(buffer_void);
289 std::vector<uint8_t> result(out_len);
290 for (
int h = 0; h < height; ++h) {
291 const uint8_t* src_line = buffer + (stride * h);
292 uint8_t* dest_line = result.data() + (width * h * 3);
293 for (
int w = 0; w < width; ++w) {
295 dest_line[w * 3] = src_line[(w * 4) + 2];
297 dest_line[(w * 3) + 1] = src_line[(w * 4) + 1];
299 dest_line[(w * 3) + 2] = src_line[w * 4];
302 if (fwrite(result.data(), out_len, 1, fp) != 1) {
303 fprintf(stderr,
"Failed to write to %s\n", filename.c_str());
310void WriteText(FPDF_TEXTPAGE textpage,
const char* pdf_name,
int num) {
311 std::string filename = GeneratePageOutputFilename(pdf_name, num,
"txt");
312 if (filename.empty()) {
315 FILE* fp = fopen(filename.c_str(),
"w");
317 fprintf(stderr,
"Failed to open %s for output\n", filename.c_str());
322 uint32_t bom = 0x0000FEFF;
323 if (fwrite(&bom,
sizeof(bom), 1, fp) != 1) {
324 fprintf(stderr,
"Failed to write to %s\n", filename.c_str());
331 if (fwrite(&c,
sizeof(c), 1, fp) != 1) {
332 fprintf(stderr,
"Failed to write to %s\n", filename.c_str());
339void WriteAnnot(FPDF_PAGE page,
const char* pdf_name,
int num) {
341 std::string filename = GeneratePageOutputFilename(pdf_name, num,
"annot.txt");
342 if (filename.empty()) {
345 FILE* fp = fopen(filename.c_str(),
"w");
347 fprintf(stderr,
"Failed to open %s for output\n", filename.c_str());
352 fprintf(fp,
"Number of annotations: %d\n\n", annot_count);
355 for (
int i = 0; i < annot_count; ++i) {
357 fprintf(fp,
"Annotation #%d:\n", i + 1);
358 ScopedFPDFAnnotation annot(FPDFPage_GetAnnot(page, i));
360 fprintf(fp,
"Failed to retrieve annotation!\n\n");
364 FPDF_ANNOTATION_SUBTYPE subtype = FPDFAnnot_GetSubtype(annot.get());
365 fprintf(fp,
"Subtype: %s\n", AnnotSubtypeToCString(subtype));
368 fprintf(fp,
"Flags set: %s\n",
369 AnnotFlagsToString(FPDFAnnot_GetFlags(annot.get())).c_str());
372 const int obj_count = FPDFAnnot_GetObjectCount(annot.get());
373 fprintf(fp,
"Number of objects: %d\n", obj_count);
375 fprintf(fp,
"Object types: ");
376 for (
int j = 0; j < obj_count; ++j) {
377 const char* type = PageObjectTypeToCString(
378 FPDFPageObj_GetType(FPDFAnnot_GetObject(annot.get(), j)));
379 fprintf(fp,
"%s ", type);
391 fprintf(fp,
"Color in RGBA: %d %d %d %d\n", R, G, B, A);
393 fprintf(fp,
"Failed to retrieve color.\n");
397 fprintf(fp,
"Interior color in RGBA: %d %d %d %d\n", R, G, B, A);
399 fprintf(fp,
"Failed to retrieve interior color.\n");
403 static constexpr char kContentsKey[] =
"Contents";
404 static constexpr char kAuthorKey[] =
"T";
405 unsigned long length_bytes =
406 FPDFAnnot_GetStringValue(annot.get(), kContentsKey,
nullptr, 0);
407 std::vector<FPDF_WCHAR> buf = GetFPDFWideStringBuffer(length_bytes);
408 FPDFAnnot_GetStringValue(annot.get(), kContentsKey, buf.data(),
410 fprintf(fp,
"Content: %ls\n", GetPlatformWString(buf.data()).c_str());
412 FPDFAnnot_GetStringValue(annot.get(), kAuthorKey,
nullptr, 0);
413 buf = GetFPDFWideStringBuffer(length_bytes);
414 FPDFAnnot_GetStringValue(annot.get(), kAuthorKey, buf.data(), length_bytes);
415 fprintf(fp,
"Author: %ls\n", GetPlatformWString(buf.data()).c_str());
418 if (FPDFAnnot_HasAttachmentPoints(annot.get())) {
419 size_t qp_count = FPDFAnnot_CountAttachmentPoints(annot.get());
420 fprintf(fp,
"Number of quadpoints sets: %zu\n", qp_count);
423 for (size_t j = 0; j < qp_count; ++j) {
424 FS_QUADPOINTSF quadpoints;
425 if (FPDFAnnot_GetAttachmentPoints(annot.get(), j, &quadpoints)) {
427 "Quadpoints set #%zu: (%.3f, %.3f), (%.3f, %.3f), "
428 "(%.3f, %.3f), (%.3f, %.3f)\n",
429 j + 1, quadpoints.x1, quadpoints.y1, quadpoints.x2,
430 quadpoints.y2, quadpoints.x3, quadpoints.y3, quadpoints.x4,
433 fprintf(fp,
"Failed to retrieve quadpoints set #%zu.\n", j + 1);
440 if (FPDFAnnot_GetRect(annot.get(), &rect)) {
441 fprintf(fp,
"Rectangle: l - %.3f, b - %.3f, r - %.3f, t - %.3f\n\n",
442 rect.left, rect.bottom, rect.right, rect.top);
444 fprintf(fp,
"Failed to retrieve annotation rectangle.\n");
457 if (!CheckDimensions(stride, width, height)) {
461 auto input = pdfium::make_span(
static_cast<uint8_t*>(buffer),
462 static_cast<size_t>(stride) * height);
463 std::vector<uint8_t> png_encoding =
465 if (png_encoding.empty()) {
466 fprintf(stderr,
"Failed to convert bitmap to PNG\n");
470 std::string filename = GeneratePageOutputFilename(pdf_name, num,
"png");
471 if (filename.empty()) {
472 return std::string();
474 FILE* fp = fopen(filename.c_str(),
"wb");
476 fprintf(stderr,
"Failed to open %s for output\n", filename.c_str());
477 return std::string();
480 size_t bytes_written =
481 fwrite(&png_encoding.front(), 1, png_encoding.size(), fp);
482 if (bytes_written != png_encoding.size()) {
483 fprintf(stderr,
"Failed to write to %s\n", filename.c_str());
491std::string WriteBmp(
const char* pdf_name,
497 if (!CheckDimensions(stride, width, height)) {
498 return std::string();
501 int out_len = stride * height;
502 if (out_len > INT_MAX / 3) {
503 return std::string();
506 std::string filename = GeneratePageOutputFilename(pdf_name, num,
"bmp");
507 if (filename.empty()) {
508 return std::string();
510 FILE* fp = fopen(filename.c_str(),
"wb");
512 return std::string();
516 bmi.bmiHeader.biSize =
sizeof(bmi) -
sizeof(RGBQUAD);
517 bmi.bmiHeader.biWidth = width;
518 bmi.bmiHeader.biHeight = -height;
519 bmi.bmiHeader.biPlanes = 1;
520 bmi.bmiHeader.biBitCount = 32;
521 bmi.bmiHeader.biCompression = BI_RGB;
522 bmi.bmiHeader.biSizeImage = 0;
524 BITMAPFILEHEADER file_header = {};
525 file_header.bfType = 0x4d42;
526 file_header.bfSize =
sizeof(file_header) + bmi.bmiHeader.biSize + out_len;
527 file_header.bfOffBits = file_header.bfSize - out_len;
529 if (fwrite(&file_header,
sizeof(file_header), 1, fp) != 1 ||
530 fwrite(&bmi, bmi.bmiHeader.biSize, 1, fp) != 1 ||
531 fwrite(buffer, out_len, 1, fp) != 1) {
532 fprintf(stderr,
"Failed to write to %s\n", filename.c_str());
538void WriteEmf(FPDF_PAGE page,
const char* pdf_name,
int num) {
539 std::string filename = GeneratePageOutputFilename(pdf_name, num,
"emf");
540 if (filename.empty()) {
544 HDC dc = CreateEnhMetaFileA(
nullptr, filename.c_str(),
nullptr,
nullptr);
546 int width =
static_cast<
int>(FPDF_GetPageWidthF(page));
547 int height =
static_cast<
int>(FPDF_GetPageHeightF(page));
548 HRGN rgn = CreateRectRgn(0, 0, width, height);
549 SelectClipRgn(dc, rgn);
552 SelectObject(dc, GetStockObject(NULL_PEN));
553 SelectObject(dc, GetStockObject(WHITE_BRUSH));
555 Rectangle(dc, 0, 0, width + 1, height + 1);
557 FPDF_RenderPage(dc, page, 0, 0, width, height, 0, FPDF_ANNOT | FPDF_PRINTING);
559 DeleteEnhMetaFile(CloseEnhMetaFile(dc));
562void WritePS(FPDF_PAGE page,
const char* pdf_name,
int num) {
563 std::string filename = GeneratePageOutputFilename(pdf_name, num,
"ps");
564 if (filename.empty()) {
567 FILE* fp = fopen(filename.c_str(),
"wb");
572 HDC dc = CreateEnhMetaFileA(
nullptr,
nullptr,
nullptr,
nullptr);
574 int width =
static_cast<
int>(FPDF_GetPageWidthF(page));
575 int height =
static_cast<
int>(FPDF_GetPageHeightF(page));
576 FPDF_RenderPage(dc, page, 0, 0, width, height, 0, FPDF_ANNOT | FPDF_PRINTING);
578 HENHMETAFILE emf = CloseEnhMetaFile(dc);
579 std::vector<
const ENHMETARECORD*> items;
580 EnumEnhMetaFile(
nullptr, emf, &EnhMetaFileProc, &items,
nullptr);
581 for (
const ENHMETARECORD* record : items) {
582 if (record->iType != EMR_GDICOMMENT) {
586 const auto* comment =
reinterpret_cast<
const EMRGDICOMMENT*>(record);
587 const char* data =
reinterpret_cast<
const char*>(comment->Data);
588 uint16_t size = *
reinterpret_cast<
const uint16_t*>(data);
589 if (fwrite(data +
sizeof(uint16_t), size, 1, fp) != 1) {
590 fprintf(stderr,
"Failed to write to %s\n", filename.c_str());
595 DeleteEnhMetaFile(emf);
599#ifdef PDF_ENABLE_SKIA
600std::unique_ptr<SkWStream> WriteToSkWStream(
const std::string& pdf_name,
602 const std::string& extension) {
603 std::string discarded_filename;
604 return WriteToSkWStream(pdf_name, num, extension, discarded_filename);
607std::unique_ptr<SkWStream> WriteToSkWStream(
const std::string& pdf_name,
609 const std::string& extension,
610 std::string& filename) {
612 GeneratePageOutputFilename(pdf_name.c_str(), num, extension.c_str());
613 if (filename.empty()) {
617 auto stream = std::make_unique<SkFILEWStream>(filename.c_str());
618 if (!stream->isValid()) {
625std::string WriteSkp(
const char* pdf_name,
int num,
const SkPicture& picture) {
626 std::string filename;
627 std::unique_ptr<SkWStream> stream =
628 WriteToSkWStream(pdf_name, num,
"skp", filename);
633 procs.fImageProc = [](SkImage* img,
void*) -> sk_sp<SkData> {
634 return SkPngEncoder::Encode(
nullptr, img, SkPngEncoder::Options{});
637 picture.serialize(stream.get(), &procs);
645 size_t name_buf_size,
646 const char* pdf_name,
650 switch (decode_type) {
652 format =
"%s.thumbnail.%d.png";
655 format =
"%s.thumbnail.decoded.%d.bin";
658 format =
"%s.thumbnail.raw.%d.bin";
662 int chars_formatted =
663 snprintf(name_buf, name_buf_size, format, pdf_name, page_num);
664 if (chars_formatted < 0 ||
665 static_cast<size_t>(chars_formatted) >= name_buf_size) {
666 fprintf(stderr,
"Filename %s for saving is too long.\n", name_buf);
675 const char* filename,
676 const char* filetype) {
677 FILE* fp = fopen(filename,
"wb");
679 fprintf(stderr,
"Failed to open %s for saving %s.", filename, filetype);
683 size_t bytes_written = fwrite(buf, 1, buflen, fp);
684 if (bytes_written == buflen) {
685 fprintf(stderr,
"Successfully wrote %s %s.\n", filetype, filename);
687 fprintf(stderr,
"Failed to write to %s.\n", filename);
693 std::vector<uint8_t> png_encoding;
694 int format = FPDFBitmap_GetFormat(bitmap.get());
699 int width = FPDFBitmap_GetWidth(bitmap.get());
700 int height = FPDFBitmap_GetHeight(bitmap.get());
701 int stride = FPDFBitmap_GetStride(bitmap.get());
702 if (!CheckDimensions(stride, width, height)) {
706 auto input = pdfium::make_span(
707 static_cast<
const uint8_t*>(FPDFBitmap_GetBuffer(bitmap.get())),
708 static_cast<size_t>(stride) * height);
710 png_encoding = EncodePng(input, width, height, stride, format);
719 std::string attachment_name;
722 std::vector<FPDF_WCHAR> buf = GetFPDFWideStringBuffer(length_bytes);
723 unsigned long actual_length_bytes =
724 FPDFAttachment_GetName(attachment, buf.data(), length_bytes);
725 if (actual_length_bytes == length_bytes) {
726 attachment_name = GetPlatformString(buf.data());
729 if (attachment_name.empty()) {
730 fprintf(stderr,
"Attachment #%d has an empty file name.\n", i + 1);
736 int chars_formatted =
737 snprintf(save_name,
sizeof(save_name),
"%s.attachment.%s", name.c_str(),
738 attachment_name.c_str());
739 if (chars_formatted < 0 ||
740 static_cast<size_t>(chars_formatted) >=
sizeof(save_name)) {
741 fprintf(stderr,
"Filename %s is too long.\n", save_name);
747 fprintf(stderr,
"Failed to retrieve attachment \"%s\".\n",
748 attachment_name.c_str());
752 std::vector<
char> data_buf(length_bytes);
754 unsigned long actual_length_bytes;
755 if (!FPDFAttachment_GetFile(attachment, data_buf.data(), length_bytes,
756 &actual_length_bytes)) {
757 fprintf(stderr,
"Failed to retrieve attachment \"%s\".\n",
758 attachment_name.c_str());
765 WriteBufferToFile(data_buf.data(), length_bytes, save_name,
"attachment");
769void WriteImages(FPDF_PAGE page,
const char* pdf_name,
int page_num) {
776 ScopedFPDFBitmap bitmap(FPDFImageObj_GetBitmap(obj));
778 fprintf(stderr,
"Image object #%d on page #%d has an empty bitmap.\n",
779 i + 1, page_num + 1);
783 std::string filename =
784 GenerateImageOutputFilename(pdf_name, page_num, i,
"png");
785 if (filename.empty()) {
789 std::vector<uint8_t> png_encoding = EncodeBitmapToPng(std::move(bitmap));
790 if (png_encoding.empty()) {
792 "Failed to convert image object #%d, on page #%d to png.\n",
793 i + 1, page_num + 1);
797 WriteBufferToFile(&png_encoding.front(), png_encoding.size(),
798 filename.c_str(),
"image");
804 const char* pdf_name,
812 ScopedFPDFBitmap bitmap(FPDFImageObj_GetRenderedBitmap(doc, page, obj));
814 fprintf(stderr,
"Image object #%d on page #%d has an empty bitmap.\n",
815 i + 1, page_num + 1);
819 std::string filename =
820 GenerateImageOutputFilename(pdf_name, page_num, i,
"png");
821 if (filename.empty()) {
825 std::vector<uint8_t> png_encoding = EncodeBitmapToPng(std::move(bitmap));
826 if (png_encoding.empty()) {
828 "Failed to convert image object #%d, on page #%d to png.\n",
829 i + 1, page_num + 1);
833 WriteBufferToFile(&png_encoding.front(), png_encoding.size(),
834 filename.c_str(),
"image");
839 const char* pdf_name,
842 if (!GetThumbnailFilename(filename,
sizeof(filename), pdf_name, page_num,
843 ThumbnailDecodeType::kDecodedStream)) {
847 unsigned long decoded_data_size =
851 if (decoded_data_size == 0) {
852 fprintf(stderr,
"Failed to get decoded thumbnail for page #%d.\n",
857 std::vector<uint8_t> thumb_buf(decoded_data_size);
858 if (FPDFPage_GetDecodedThumbnailData(
859 page, thumb_buf.data(), decoded_data_size) != decoded_data_size) {
860 fprintf(stderr,
"Failed to get decoded thumbnail data for %s.\n", filename);
864 WriteBufferToFile(thumb_buf.data(), decoded_data_size, filename,
865 "decoded thumbnail");
869 const char* pdf_name,
872 if (!GetThumbnailFilename(filename,
sizeof(filename), pdf_name, page_num,
873 ThumbnailDecodeType::kRawStream)) {
880 if (raw_data_size == 0) {
881 fprintf(stderr,
"Failed to get raw thumbnail data for page #%d.\n",
886 std::vector<uint8_t> thumb_buf(raw_data_size);
887 if (FPDFPage_GetRawThumbnailData(page, thumb_buf.data(), raw_data_size) !=
889 fprintf(stderr,
"Failed to get raw thumbnail data for %s.\n", filename);
893 WriteBufferToFile(thumb_buf.data(), raw_data_size, filename,
"raw thumbnail");
898 if (!GetThumbnailFilename(filename,
sizeof(filename), pdf_name, page_num,
899 ThumbnailDecodeType::kBitmap)) {
903 ScopedFPDFBitmap thumb_bitmap(FPDFPage_GetThumbnailAsBitmap(page));
905 fprintf(stderr,
"Thumbnail of page #%d has an empty bitmap.\n",
910 std::vector<uint8_t> png_encoding =
911 EncodeBitmapToPng(std::move(thumb_bitmap));
912 if (png_encoding.empty()) {
913 fprintf(stderr,
"Failed to convert thumbnail of page #%d to png.\n",
918 WriteBufferToFile(&png_encoding.front(), png_encoding.size(), filename,
#define FPDF_ANNOT_FILEATTACHMENT
#define FPDF_ANNOT_RICHMEDIA
#define FPDF_ANNOT_FLAG_INVISIBLE
#define FPDF_ANNOT_FLAG_NOROTATE
#define FPDF_ANNOT_FLAG_NOZOOM
#define FPDF_ANNOT_FLAG_HIDDEN
#define FPDF_ANNOT_FLAG_PRINT
#define FPDF_ANNOT_THREED
#define FPDF_ANNOT_STRIKEOUT
#define FPDF_ANNOT_UNDERLINE
#define FPDF_ANNOT_SCREEN
#define FPDF_ANNOT_FLAG_READONLY
FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotCount(FPDF_PAGE page)
#define FPDF_ANNOT_WATERMARK
#define FPDF_ANNOT_XFAWIDGET
#define FPDF_ANNOT_WIDGET
#define FPDF_ANNOT_HIGHLIGHT
#define FPDF_ANNOT_TRAPNET
#define FPDF_ANNOT_SQUIGGLY
#define FPDF_ANNOT_FLAG_LOCKED
#define FPDF_ANNOT_SQUARE
#define FPDF_ANNOT_FREETEXT
#define FPDF_ANNOT_FLAG_NOVIEW
#define FPDF_ANNOT_POLYGON
@ FPDFANNOT_COLORTYPE_InteriorColor
@ FPDFANNOT_COLORTYPE_Color
#define FPDF_ANNOT_FLAG_TOGGLENOVIEW
#define FPDF_ANNOT_CIRCLE
#define FPDF_ANNOT_PRINTERMARK
#define FPDF_ANNOT_POLYLINE
FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetAttachmentCount(FPDF_DOCUMENT document)
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAttachment_GetName(FPDF_ATTACHMENT attachment, FPDF_WCHAR *buffer, unsigned long buflen)
FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV FPDFDoc_GetAttachment(FPDF_DOCUMENT document, int index)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAttachment_GetFile(FPDF_ATTACHMENT attachment, void *buffer, unsigned long buflen, unsigned long *out_buflen)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page, int index)
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object)
#define FPDF_PAGEOBJ_PATH
#define FPDF_PAGEOBJ_TEXT
#define FPDF_PAGEOBJ_SHADING
#define FPDF_PAGEOBJ_IMAGE
#define FPDF_PAGEOBJ_FORM
FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObjects(FPDF_PAGE page)
FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountChars(FPDF_TEXTPAGE text_page)
FPDF_EXPORT unsigned int FPDF_CALLCONV FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index)
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFPage_GetRawThumbnailData(FPDF_PAGE page, void *buffer, unsigned long buflen)
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFPage_GetDecodedThumbnailData(FPDF_PAGE page, void *buffer, unsigned long buflen)
#define FPDFBitmap_Unknown
bool GetThumbnailFilename(char *name_buf, size_t name_buf_size, const char *pdf_name, int page_num, ThumbnailDecodeType decode_type)
void WriteDecodedThumbnailStream(FPDF_PAGE page, const char *pdf_name, int page_num)
void WriteRenderedImages(FPDF_DOCUMENT doc, FPDF_PAGE page, const char *pdf_name, int page_num)
void WriteBufferToFile(const void *buf, size_t buflen, const char *filename, const char *filetype)
void WriteRawThumbnailStream(FPDF_PAGE page, const char *pdf_name, int page_num)
std::vector< uint8_t > EncodeBitmapToPng(ScopedFPDFBitmap bitmap)
void WriteAnnot(FPDF_PAGE page, const char *pdf_name, int num)
void WriteImages(FPDF_PAGE page, const char *pdf_name, int page_num)
std::string WritePng(const char *pdf_name, int num, void *buffer, int stride, int width, int height)
void WriteThumbnail(FPDF_PAGE page, const char *pdf_name, int page_num)
void WriteText(FPDF_TEXTPAGE textpage, const char *pdf_name, int num)
std::string WritePpm(const char *pdf_name, int num, void *buffer_void, int stride, int width, int height)
void WriteAttachments(FPDF_DOCUMENT doc, const std::string &name)