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

Side by Side Diff: pdf/pdf_engine.h

Issue 376083002: Export a function from the PDF plugin to get the dimensions of a PDF page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typo in comments. Moved all the comments over to pdf_engine.h. 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
« no previous file with comments | « pdf/pdf.cc ('k') | pdf/pdfium/pdfium_engine.h » ('j') | 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 #ifndef PDF_PDF_ENGINE_H_ 5 #ifndef PDF_PDF_ENGINE_H_
6 #define PDF_PDF_ENGINE_H_ 6 #define PDF_PDF_ENGINE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 bool stretch_to_bounds; 288 bool stretch_to_bounds;
289 bool keep_aspect_ratio; 289 bool keep_aspect_ratio;
290 bool center_in_bounds; 290 bool center_in_bounds;
291 bool autorotate; 291 bool autorotate;
292 }; 292 };
293 293
294 PDFEngineExports() {} 294 PDFEngineExports() {}
295 virtual ~PDFEngineExports() {} 295 virtual ~PDFEngineExports() {}
296 static PDFEngineExports* Create(); 296 static PDFEngineExports* Create();
297 #if defined(OS_WIN) 297 #if defined(OS_WIN)
298 // See the definition of RenderPDFPageToDC in pdf.cc for details. 298 // |pdf_buffer| is the buffer that contains the entire PDF document to be
299 // rendered.
300 // |buffer_size| is the size of |pdf_buffer| in bytes.
301 // |page_number| is the 0-based index of the page to be rendered.
302 // |dc| is the device context to render into.
Dan Beam 2014/07/09 23:18:24 remove from here down:
303 // |dpi_x| and |dpi_y| are the x and y resolutions respectively. If either
304 // value is -1, the dpi from the DC will be used.
305 // |bounds_origin_x|, |bounds_origin_y|, |bounds_width| and |bounds_height|
306 // specify a bounds rectangle within the DC in which to render the PDF
307 // page.
308 // |fit_to_bounds| specifies whether the output should be shrunk to fit the
309 // supplied bounds if the page size is larger than the bounds in any
310 // dimension. If this is false, parts of the PDF page that lie outside
311 // the bounds will be clipped.
312 // |stretch_to_bounds| specifies whether the output should be stretched to fit
313 // the supplied bounds if the page size is smaller than the bounds in any
314 // dimension.
315 // If both |fit_to_bounds| and |stretch_to_bounds| are true, then
316 // |fit_to_bounds| is honored first.
317 // |keep_aspect_ratio| If any scaling is to be done is true, this flag
318 // specifies whether the original aspect ratio of the page should be
319 // preserved while scaling.
320 // |center_in_bounds| specifies whether the final image (after any scaling is
321 // done) should be centered within the given bounds.
322 // |autorotate| specifies whether the final image should be rotated to match
323 // the output bound.
Dan Beam 2014/07/09 23:18:23 ^ to here
324 // Returns false if the document or the page number are not valid.
299 virtual bool RenderPDFPageToDC(const void* pdf_buffer, 325 virtual bool RenderPDFPageToDC(const void* pdf_buffer,
300 int buffer_size, 326 int buffer_size,
301 int page_number, 327 int page_number,
302 const RenderingSettings& settings, 328 const RenderingSettings& settings,
303 HDC dc) = 0; 329 HDC dc) = 0;
304 #endif // OS_WIN 330 #endif // OS_WIN
Dan Beam 2014/07/09 23:18:24 nit: \n
305 // See the definition of RenderPDFPageToBitmap in pdf.cc for details. 331 // Renders PDF page into 4-byte per pixel BGRA color bitmap.
332 // |pdf_buffer| is the buffer that contains the entire PDF document to be
333 // rendered.
334 // |pdf_buffer_size| is the size of |pdf_buffer| in bytes.
335 // |page_number| is the 0-based index of the page to be rendered.
336 // |bitmap_buffer| is the output buffer for bitmap.
337 // |bitmap_width| is the width of the output bitmap.
Dan Beam 2014/07/09 23:18:24 I don't see |bitmap_width|, |bitmap_height|, |dpi|
338 // |bitmap_height| is the height of the output bitmap.
339 // |dpi| is the resolutions.
340 // |autorotate| specifies whether the final image should be rotated to match
341 // the output bound.
342 // Returns false if the document or the page number are not valid.
306 virtual bool RenderPDFPageToBitmap(const void* pdf_buffer, 343 virtual bool RenderPDFPageToBitmap(const void* pdf_buffer,
307 int pdf_buffer_size, 344 int pdf_buffer_size,
308 int page_number, 345 int page_number,
309 const RenderingSettings& settings, 346 const RenderingSettings& settings,
310 void* bitmap_buffer) = 0; 347 void* bitmap_buffer) = 0;
Dan Beam 2014/07/09 23:18:23 nit: \n
348 // |page_count| and |max_page_width| are optional and can be NULL.
349 // Returns false if the document is not valid.
311 virtual bool GetPDFDocInfo(const void* pdf_buffer, 350 virtual bool GetPDFDocInfo(const void* pdf_buffer,
312 int buffer_size, 351 int buffer_size,
313 int* page_count, 352 int* page_count,
314 double* max_page_width) = 0; 353 double* max_page_width) = 0;
354
355 // Gets the dimensions of a specific page in a document.
356 // |pdf_buffer| is the buffer that contains the entire PDF document to be
357 // rendered.
358 // |pdf_buffer_size| is the size of |pdf_buffer| in bytes.
359 // |page_number| is the page number that the function will get the dimensions
360 // of.
361 // |width| is the output for the width of the page in points.
362 // |height| is the output for the height of the page in points.
363 // Returns false if the document or the page number are not valid.
364 virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer,
365 int pdf_buffer_size, int page_number,
366 double* width, double* height) = 0;
315 }; 367 };
316 368
317 } // namespace chrome_pdf 369 } // namespace chrome_pdf
318 370
319 #endif // PDF_PDF_ENGINE_H_ 371 #endif // PDF_PDF_ENGINE_H_
OLDNEW
« no previous file with comments | « pdf/pdf.cc ('k') | pdf/pdfium/pdfium_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698