Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: pdf/pdfium/pdfium_engine.cc

Issue 335583004: Added a test that currently is able to print to pdf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored print_preview.js and the browsertest. Made browsertest multiplatform compatible. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« pdf/libpdf.map ('K') | « pdf/pdfium/pdfium_engine.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 FPDF_GetPageSizeByIndex(doc, page_number, &page_width, &page_height); 3377 FPDF_GetPageSizeByIndex(doc, page_number, &page_width, &page_height);
3378 if (page_width > *max_page_width) { 3378 if (page_width > *max_page_width) {
3379 *max_page_width = page_width; 3379 *max_page_width = page_width;
3380 } 3380 }
3381 } 3381 }
3382 } 3382 }
3383 FPDF_CloseDocument(doc); 3383 FPDF_CloseDocument(doc);
3384 return true; 3384 return true;
3385 } 3385 }
3386 3386
3387 bool PDFiumEngineExports::GetPDFPageSizeByIndex(
3388 const void* pdf_buffer,
3389 int buffer_size,
3390 int index,
3391 double* width,
3392 double* height) {
3393 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, buffer_size, NULL);
3394 bool ret_value;
3395
3396 if (!doc)
3397 return false;
3398
3399 if (!FPDF_GetPageSizeByIndex(doc, index, width, height))
3400 ret_value = false;
3401
3402 FPDF_CloseDocument(doc);
3403 ret_value = true;
Dan Beam 2014/07/07 23:08:12 just always return true, ret_value is always overw
ivandavid 2014/07/08 01:07:42 Done.
ivandavid 2014/07/08 01:07:42 Oops. Didn't mean to assign it to true there. It a
Lei Zhang 2014/07/08 01:11:37 I think what you want is: if (!doc) return fals
Dan Beam 2014/07/08 04:25:13 if we're gonna keep this code, s/retval ==/success
ivandavid 2014/07/08 23:24:21 Done.
3404
3405 return ret_value;
3406 }
3407
3387 } // namespace chrome_pdf 3408 } // namespace chrome_pdf
OLDNEW
« pdf/libpdf.map ('K') | « pdf/pdfium/pdfium_engine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698