0

Printing: Load the source PDF only once.

Instead of loading the PDF once per operation, which is slightly more
than once per page.

Review-Url: https://codereview.chromium.org/2508563003
Cr-Commit-Position: refs/heads/master@{#432594}
This commit is contained in:
thestig
2016-11-16 11:37:58 -08:00
committed by Commit bot
parent 54cd9dad1e
commit fe899c8e19
11 changed files with 150 additions and 151 deletions

@ -340,7 +340,7 @@ void PdfToEmfUtilityProcessHostClient::OnTempPdfReady(bool print_text_with_gdi,
if (!utility_process_host_ || !pdf)
return OnFailed();
// Should reply with OnPageCount().
Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles(
Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_Start(
IPC::GetPlatformFileForTransit(pdf->GetPlatformFile(), false), settings_,
print_text_with_gdi));
}

@ -335,29 +335,25 @@ class PrintPreviewPdfGeneratedBrowserTest : public InProcessBrowserTest {
// Converts the PDF to a PNG file so that the layout test can do an image
// diff on this image and a reference image.
void PdfToPng() {
std::string pdf_data;
ASSERT_TRUE(base::ReadFileToString(pdf_file_save_path_, &pdf_data));
int num_pages;
double max_width_in_points = 0;
std::vector<uint8_t> bitmap_data;
double total_height_in_pixels = 0;
std::string pdf_data;
ASSERT_TRUE(base::ReadFileToString(pdf_file_save_path_, &pdf_data));
ASSERT_TRUE(chrome_pdf::GetPDFDocInfo(pdf_data.data(),
pdf_data.size(),
&num_pages,
&max_width_in_points));
void* pdf_handle = nullptr;
ASSERT_TRUE(chrome_pdf::GetPDFDocInfo(pdf_data.data(), pdf_data.size(),
&num_pages, &max_width_in_points,
&pdf_handle));
ASSERT_GT(num_pages, 0);
double max_width_in_pixels =
ConvertUnitDouble(max_width_in_points, kPointsPerInch, kDpi);
std::vector<uint8_t> bitmap_data;
double total_height_in_pixels = 0;
for (int i = 0; i < num_pages; ++i) {
double width_in_points, height_in_points;
ASSERT_TRUE(chrome_pdf::GetPDFPageSizeByIndex(pdf_data.data(),
pdf_data.size(),
i,
&width_in_points,
&height_in_points));
ASSERT_TRUE(chrome_pdf::GetPDFPageSizeByIndex(
pdf_handle, i, &width_in_points, &height_in_points));
double width_in_pixels = ConvertUnitDouble(
width_in_points, kPointsPerInch, kDpi);
@ -388,14 +384,9 @@ class PrintPreviewPdfGeneratedBrowserTest : public InProcessBrowserTest {
kColorChannels * settings.area().size().GetArea());
ASSERT_TRUE(chrome_pdf::RenderPDFPageToBitmap(
pdf_data.data(),
pdf_data.size(),
i,
page_bitmap_data.data(),
settings.area().size().width(),
settings.area().size().height(),
settings.dpi(),
true));
pdf_handle, i, page_bitmap_data.data(),
settings.area().size().width(), settings.area().size().height(),
settings.dpi(), true));
FillPng(&page_bitmap_data,
width_in_pixels,
max_width_in_pixels,
@ -405,6 +396,7 @@ class PrintPreviewPdfGeneratedBrowserTest : public InProcessBrowserTest {
page_bitmap_data.end());
}
chrome_pdf::ReleasePDFHandle(pdf_handle);
CreatePng(bitmap_data, max_width_in_pixels, total_height_in_pixels);
}

@ -99,7 +99,7 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults,
// Tell the utility process to start rendering the given PDF into a metafile.
// Utility process would be alive until
// ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message.
IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Start,
IPC::PlatformFileForTransit /* input_file */,
printing::PdfRenderSettings /* settings */,
bool /* print_text_with_gdi */)

@ -97,7 +97,7 @@ class ServiceUtilityProcessHost::PdfToEmfState {
const printing::PdfRenderSettings& conversion_settings) {
if (!temp_dir_.CreateUniqueTempDir())
return false;
return host_->Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles(
return host_->Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_Start(
IPC::TakePlatformFileForTransit(std::move(pdf_file)),
conversion_settings, false /* print_text_with_gdi */));
}

@ -64,8 +64,8 @@ bool PrintingHandler::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintingHandler, message)
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
OnRenderPDFPagesToMetafile)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Start,
OnRenderPDFPagesToMetafileStart)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage,
OnRenderPDFPagesToMetafileGetPage)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop,
@ -85,7 +85,7 @@ bool PrintingHandler::OnMessageReceived(const IPC::Message& message) {
}
#if defined(OS_WIN)
void PrintingHandler::OnRenderPDFPagesToMetafile(
void PrintingHandler::OnRenderPDFPagesToMetafileStart(
IPC::PlatformFileForTransit pdf_transit,
const PdfRenderSettings& settings,
bool print_text_with_gdi) {
@ -109,6 +109,8 @@ void PrintingHandler::OnRenderPDFPagesToMetafileGetPage(
}
void PrintingHandler::OnRenderPDFPagesToMetafileStop() {
chrome_pdf::ReleasePDFHandle(pdf_handle_);
pdf_handle_ = nullptr;
ReleaseProcessIfNeeded();
}
@ -134,6 +136,8 @@ void PrintingHandler::OnRenderPDFPagesToPWGRaster(
#if defined(OS_WIN)
int PrintingHandler::LoadPDF(base::File pdf_file) {
DCHECK(!pdf_handle_);
int64_t length64 = pdf_file.GetLength();
if (length64 <= 0 || length64 > std::numeric_limits<int>::max())
return 0;
@ -145,7 +149,7 @@ int PrintingHandler::LoadPDF(base::File pdf_file) {
int total_page_count = 0;
if (!chrome_pdf::GetPDFDocInfo(&pdf_data_.front(), pdf_data_.size(),
&total_page_count, nullptr)) {
&total_page_count, nullptr, &pdf_handle_)) {
return 0;
}
return total_page_count;
@ -174,19 +178,11 @@ bool PrintingHandler::RenderPdfPageToMetafile(int page_number,
// to StartPage.
metafile.StartPage(gfx::Size(), gfx::Rect(), 1);
if (!chrome_pdf::RenderPDFPageToDC(
&pdf_data_.front(),
pdf_data_.size(),
page_number,
metafile.context(),
pdf_rendering_settings_.dpi(),
pdf_rendering_settings_.area().x(),
pdf_handle_, page_number, metafile.context(),
pdf_rendering_settings_.dpi(), pdf_rendering_settings_.area().x(),
pdf_rendering_settings_.area().y(),
pdf_rendering_settings_.area().width(),
pdf_rendering_settings_.area().height(),
true,
false,
true,
true,
pdf_rendering_settings_.area().height(), true, false, true, true,
pdf_rendering_settings_.autorotate())) {
return false;
}
@ -215,8 +211,9 @@ bool PrintingHandler::RenderPDFPagesToPWGRaster(
return false;
int total_page_count = 0;
void* pdf_handle = nullptr;
if (!chrome_pdf::GetPDFDocInfo(data.data(), data_size, &total_page_count,
nullptr)) {
nullptr, &pdf_handle)) {
return false;
}
@ -225,11 +222,14 @@ bool PrintingHandler::RenderPDFPagesToPWGRaster(
encoder.EncodeDocumentHeader(&pwg_header);
int bytes_written = bitmap_file.WriteAtCurrentPos(pwg_header.data(),
pwg_header.size());
if (bytes_written != static_cast<int>(pwg_header.size()))
if (bytes_written != static_cast<int>(pwg_header.size())) {
chrome_pdf::ReleasePDFHandle(pdf_handle);
return false;
}
cloud_print::BitmapImage image(settings.area().size(),
cloud_print::BitmapImage::BGRA);
bool ret = true;
for (int i = 0; i < total_page_count; ++i) {
int page_number = i;
@ -237,15 +237,11 @@ bool PrintingHandler::RenderPDFPagesToPWGRaster(
page_number = total_page_count - 1 - page_number;
}
if (!chrome_pdf::RenderPDFPageToBitmap(data.data(),
data_size,
page_number,
image.pixel_data(),
image.size().width(),
image.size().height(),
settings.dpi(),
autoupdate)) {
return false;
if (!chrome_pdf::RenderPDFPageToBitmap(
pdf_handle, page_number, image.pixel_data(), image.size().width(),
image.size().height(), settings.dpi(), autoupdate)) {
ret = false;
break;
}
cloud_print::PwgHeaderInfo header_info;
@ -276,14 +272,19 @@ bool PrintingHandler::RenderPDFPagesToPWGRaster(
}
std::string pwg_page;
if (!encoder.EncodePage(image, header_info, &pwg_page))
return false;
if (!encoder.EncodePage(image, header_info, &pwg_page)) {
ret = false;
break;
}
bytes_written = bitmap_file.WriteAtCurrentPos(pwg_page.data(),
pwg_page.size());
if (bytes_written != static_cast<int>(pwg_page.size()))
return false;
if (bytes_written != static_cast<int>(pwg_page.size())) {
ret = false;
break;
}
}
return true;
chrome_pdf::ReleasePDFHandle(pdf_handle);
return ret;
}
void PrintingHandler::OnGetPrinterCapsAndDefaults(

@ -36,7 +36,7 @@ class PrintingHandler : public UtilityMessageHandler {
private:
// IPC message handlers.
#if defined(OS_WIN)
void OnRenderPDFPagesToMetafile(IPC::PlatformFileForTransit pdf_transit,
void OnRenderPDFPagesToMetafileStart(IPC::PlatformFileForTransit pdf_transit,
const PdfRenderSettings& settings,
bool print_text_with_gdi);
void OnRenderPDFPagesToMetafileGetPage(
@ -70,6 +70,7 @@ class PrintingHandler : public UtilityMessageHandler {
#if defined(OS_WIN)
std::vector<char> pdf_data_;
PdfRenderSettings pdf_rendering_settings_;
void* pdf_handle_ = nullptr;
#endif
DISALLOW_COPY_AND_ASSIGN(PrintingHandler);

@ -82,8 +82,7 @@ const void* PPP_GetInterface(const char* interface_name) {
}
#if defined(OS_WIN)
bool RenderPDFPageToDC(const void* pdf_buffer,
int buffer_size,
bool RenderPDFPageToDC(void* pdf_handle,
int page_number,
HDC dc,
int dpi,
@ -107,8 +106,8 @@ bool RenderPDFPageToDC(const void* pdf_buffer,
pp::Rect(bounds_origin_x, bounds_origin_y, bounds_width, bounds_height),
fit_to_bounds, stretch_to_bounds, keep_aspect_ratio, center_in_bounds,
autorotate);
bool ret = engine_exports->RenderPDFPageToDC(pdf_buffer, buffer_size,
page_number, settings, dc);
bool ret =
engine_exports->RenderPDFPageToDC(pdf_handle, page_number, settings, dc);
if (!g_sdk_initialized_via_pepper)
ShutdownSDK();
@ -126,39 +125,51 @@ void SetPDFUseGDIPrinting(bool enable) {
#endif // defined(OS_WIN)
bool GetPDFDocInfo(const void* pdf_buffer,
int buffer_size, int* page_count,
double* max_page_width) {
int buffer_size,
int* page_count,
double* max_page_width,
void** pdf_handle) {
if (!g_sdk_initialized_via_pepper) {
if (!InitializeSDK())
return false;
}
PDFEngineExports* engine_exports = PDFEngineExports::Get();
bool ret = engine_exports->GetPDFDocInfo(
pdf_buffer, buffer_size, page_count, max_page_width);
bool ret = engine_exports->GetPDFDocInfo(pdf_buffer, buffer_size, page_count,
max_page_width, pdf_handle);
if (!g_sdk_initialized_via_pepper)
ShutdownSDK();
return ret;
}
bool GetPDFPageSizeByIndex(const void* pdf_buffer,
int pdf_buffer_size, int page_number,
double* width, double* height) {
void ReleasePDFHandle(void* pdf_handle) {
if (!g_sdk_initialized_via_pepper) {
if (!chrome_pdf::InitializeSDK())
if (!InitializeSDK())
return;
}
PDFEngineExports* engine_exports = PDFEngineExports::Get();
engine_exports->ReleasePDFHandle(pdf_handle);
if (!g_sdk_initialized_via_pepper)
ShutdownSDK();
}
bool GetPDFPageSizeByIndex(void* pdf_handle,
int page_number,
double* width,
double* height) {
if (!g_sdk_initialized_via_pepper) {
if (!InitializeSDK())
return false;
}
chrome_pdf::PDFEngineExports* engine_exports =
chrome_pdf::PDFEngineExports::Get();
bool ret = engine_exports->GetPDFPageSizeByIndex(
pdf_buffer, pdf_buffer_size, page_number, width, height);
PDFEngineExports* engine_exports = PDFEngineExports::Get();
bool ret = engine_exports->GetPDFPageSizeByIndex(pdf_handle, page_number,
width, height);
if (!g_sdk_initialized_via_pepper)
chrome_pdf::ShutdownSDK();
ShutdownSDK();
return ret;
}
bool RenderPDFPageToBitmap(const void* pdf_buffer,
int pdf_buffer_size,
bool RenderPDFPageToBitmap(void* pdf_handle,
int page_number,
void* bitmap_buffer,
int bitmap_width,
@ -173,8 +184,8 @@ bool RenderPDFPageToBitmap(const void* pdf_buffer,
PDFEngineExports::RenderingSettings settings(
dpi, dpi, pp::Rect(bitmap_width, bitmap_height), true, false, true, true,
autorotate);
bool ret = engine_exports->RenderPDFPageToBitmap(
pdf_buffer, pdf_buffer_size, page_number, settings, bitmap_buffer);
bool ret = engine_exports->RenderPDFPageToBitmap(pdf_handle, page_number,
settings, bitmap_buffer);
if (!g_sdk_initialized_via_pepper)
ShutdownSDK();

@ -36,9 +36,7 @@ void PPP_ShutdownModule();
const void* PPP_GetInterface(const char* interface_name);
#if defined(OS_WIN)
// |pdf_buffer| is the buffer that contains the entire PDF document to be
// rendered.
// |buffer_size| is the size of |pdf_buffer| in bytes.
// |pdf_handle| is the handle to the PDF document.
// |page_number| is the 0-based index of the page to be rendered.
// |dc| is the device context to render into.
// |dpi| and |dpi_y| is the resolution. If the value is -1, the dpi from the DC
@ -63,8 +61,7 @@ const void* PPP_GetInterface(const char* interface_name);
// |autorotate| specifies whether the final image should be rotated to match
// the output bound.
// Returns false if the document or the page number are not valid.
bool RenderPDFPageToDC(const void* pdf_buffer,
int buffer_size,
bool RenderPDFPageToDC(void* pdf_handle,
int page_number,
HDC dc,
int dpi,
@ -84,29 +81,35 @@ void SetPDFEnsureTypefaceCharactersAccessible(
void SetPDFUseGDIPrinting(bool enable);
#endif // defined(OS_WIN)
// |page_count| and |max_page_width| are optional and can be NULL.
// All the out parameters are optional and can be NULL.
// Returns false if the document is not valid.
// Returns true on success. In which case, if |pdf_handle| is not NULL, then
// the handle is guaranteed to be valid and not NULL. The caller takes
// ownership of |pdf_handle| and must call ReleasePDFHandle() on it when done.
bool GetPDFDocInfo(const void* pdf_buffer,
int buffer_size, int* page_count,
double* max_page_width);
int buffer_size,
int* page_count,
double* max_page_width,
void** pdf_handle);
// Releases the handle received from GetPDFDocInfo().
// |pdf_handle| can be NULL.
void ReleasePDFHandle(void* pdf_handle);
// Gets the dimensions of a specific page in a document.
// |pdf_buffer| is the buffer that contains the entire PDF document to be
// rendered.
// |pdf_buffer_size| is the size of |pdf_buffer| in bytes.
// |pdf_handle| is the handle to the PDF document.
// |page_number| is the page number that the function will get the dimensions
// of.
// |width| is the output for the width of the page in points.
// |height| is the output for the height of the page in points.
// Returns false if the document or the page number are not valid.
bool GetPDFPageSizeByIndex(const void* pdf_buffer,
int pdf_buffer_size, int page_number,
double* width, double* height);
bool GetPDFPageSizeByIndex(void* pdf_handle,
int page_number,
double* width,
double* height);
// Renders PDF page into 4-byte per pixel BGRA color bitmap.
// |pdf_buffer| is the buffer that contains the entire PDF document to be
// rendered.
// |pdf_buffer_size| is the size of |pdf_buffer| in bytes.
// |pdf_handle| is the handle to the PDF document.
// |page_number| is the 0-based index of the page to be rendered.
// |bitmap_buffer| is the output buffer for bitmap.
// |bitmap_width| is the width of the output bitmap.
@ -115,8 +118,7 @@ bool GetPDFPageSizeByIndex(const void* pdf_buffer,
// |autorotate| specifies whether the final image should be rotated to match
// the output bound.
// Returns false if the document or the page number are not valid.
bool RenderPDFPageToBitmap(const void* pdf_buffer,
int pdf_buffer_size,
bool RenderPDFPageToBitmap(void* pdf_handle,
int page_number,
void* bitmap_buffer,
int bitmap_width,

@ -333,9 +333,8 @@ class PDFEngineExports {
static PDFEngineExports* Get();
#if defined(OS_WIN)
// See the definition of RenderPDFPageToDC in pdf.cc for details.
virtual bool RenderPDFPageToDC(const void* pdf_buffer,
int buffer_size,
// See the definitions of the corresponding functions in pdf.h for details.
virtual bool RenderPDFPageToDC(void* pdf_handle,
int page_number,
const RenderingSettings& settings,
HDC dc) = 0;
@ -346,9 +345,7 @@ class PDFEngineExports {
virtual void SetPDFUseGDIPrinting(bool enable) = 0;
#endif // defined(OS_WIN)
// See the definition of RenderPDFPageToBitmap in pdf.cc for details.
virtual bool RenderPDFPageToBitmap(const void* pdf_buffer,
int pdf_buffer_size,
virtual bool RenderPDFPageToBitmap(void* pdf_handle,
int page_number,
const RenderingSettings& settings,
void* bitmap_buffer) = 0;
@ -356,12 +353,15 @@ class PDFEngineExports {
virtual bool GetPDFDocInfo(const void* pdf_buffer,
int buffer_size,
int* page_count,
double* max_page_width) = 0;
double* max_page_width,
void** pdf_handle) = 0;
// See the definition of GetPDFPageSizeByIndex in pdf.cc for details.
virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer,
int pdf_buffer_size, int page_number,
double* width, double* height) = 0;
virtual void ReleasePDFHandle(void* pdf_handle) = 0;
virtual bool GetPDFPageSizeByIndex(void* pdf_handle,
int page_number,
double* width,
double* height) = 0;
};
} // namespace chrome_pdf

@ -4004,19 +4004,17 @@ PDFEngineExports* PDFEngineExports::Get() {
}
#if defined(OS_WIN)
bool PDFiumEngineExports::RenderPDFPageToDC(const void* pdf_buffer,
int buffer_size,
bool PDFiumEngineExports::RenderPDFPageToDC(void* pdf_handle,
int page_number,
const RenderingSettings& settings,
HDC dc) {
FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, buffer_size, nullptr);
FPDF_DOCUMENT doc = pdf_handle;
if (!doc)
return false;
FPDF_PAGE page = FPDF_LoadPage(doc, page_number);
if (!page) {
FPDF_CloseDocument(doc);
if (!page)
return false;
}
RenderingSettings new_settings = settings;
// calculate the page size
if (new_settings.dpi_x == -1)
@ -4070,7 +4068,6 @@ bool PDFiumEngineExports::RenderPDFPageToDC(const void* pdf_buffer,
}
RestoreDC(dc, save_state);
FPDF_ClosePage(page);
FPDF_CloseDocument(doc);
return true;
}
@ -4086,20 +4083,16 @@ void PDFiumEngineExports::SetPDFUseGDIPrinting(bool enable) {
#endif // defined(OS_WIN)
bool PDFiumEngineExports::RenderPDFPageToBitmap(
const void* pdf_buffer,
int pdf_buffer_size,
void* pdf_handle,
int page_number,
const RenderingSettings& settings,
void* bitmap_buffer) {
FPDF_DOCUMENT doc =
FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
FPDF_DOCUMENT doc = pdf_handle;
if (!doc)
return false;
FPDF_PAGE page = FPDF_LoadPage(doc, page_number);
if (!page) {
FPDF_CloseDocument(doc);
if (!page)
return false;
}
pp::Rect dest;
int rotate = CalculatePosition(page, settings, &dest);
@ -4118,49 +4111,49 @@ bool PDFiumEngineExports::RenderPDFPageToBitmap(
FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH);
FPDFBitmap_Destroy(bitmap);
FPDF_ClosePage(page);
FPDF_CloseDocument(doc);
return true;
}
bool PDFiumEngineExports::GetPDFDocInfo(const void* pdf_buffer,
int buffer_size,
int* page_count,
double* max_page_width) {
double* max_page_width,
void** pdf_handle) {
FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, buffer_size, nullptr);
if (!doc)
return false;
int page_count_local = FPDF_GetPageCount(doc);
if (page_count) {
if (page_count)
*page_count = page_count_local;
}
if (max_page_width) {
*max_page_width = 0;
for (int page_number = 0; page_number < page_count_local; page_number++) {
double page_width = 0;
double page_height = 0;
FPDF_GetPageSizeByIndex(doc, page_number, &page_width, &page_height);
if (page_width > *max_page_width) {
*max_page_width = page_width;
}
*max_page_width = std::max(*max_page_width, page_width);
}
}
FPDF_CloseDocument(doc);
if (pdf_handle)
*pdf_handle = doc; // Caller takes ownership.
else
FPDF_CloseDocument(pdf_handle);
return true;
}
bool PDFiumEngineExports::GetPDFPageSizeByIndex(
const void* pdf_buffer,
int pdf_buffer_size,
int page_number,
double* width,
double* height) {
FPDF_DOCUMENT doc =
FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
if (!doc)
return false;
bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
FPDF_CloseDocument(doc);
return success;
void PDFiumEngineExports::ReleasePDFHandle(void* pdf_handle) {
FPDF_CloseDocument(pdf_handle);
}
bool PDFiumEngineExports::GetPDFPageSizeByIndex(void* pdf_handle,
int page_number,
double* width,
double* height) {
FPDF_DOCUMENT doc = pdf_handle;
return doc && FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
}
} // namespace chrome_pdf

@ -771,8 +771,7 @@ class PDFiumEngineExports : public PDFEngineExports {
// PDFEngineExports:
#if defined(OS_WIN)
bool RenderPDFPageToDC(const void* pdf_buffer,
int buffer_size,
bool RenderPDFPageToDC(void* pdf_handle,
int page_number,
const RenderingSettings& settings,
HDC dc) override;
@ -781,17 +780,17 @@ class PDFiumEngineExports : public PDFEngineExports {
void SetPDFUseGDIPrinting(bool enable) override;
#endif // defined(OS_WIN)
bool RenderPDFPageToBitmap(const void* pdf_buffer,
int pdf_buffer_size,
bool RenderPDFPageToBitmap(void* pdf_handle,
int page_number,
const RenderingSettings& settings,
void* bitmap_buffer) override;
bool GetPDFDocInfo(const void* pdf_buffer,
int buffer_size,
int* page_count,
double* max_page_width) override;
bool GetPDFPageSizeByIndex(const void* pdf_buffer,
int pdf_buffer_size,
double* max_page_width,
void** pdf_handle) override;
void ReleasePDFHandle(void* pdf_handle) override;
bool GetPDFPageSizeByIndex(void* pdf_handle,
int page_number,
double* width,
double* height) override;