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

Unified Diff: pdf/pdf.cc

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: Redid comments to conform to the style of existing comment. Rename parameters for same reason. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pdf/pdf_engine.h » ('j') | pdf/pdf_engine.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdf.cc
diff --git a/pdf/pdf.cc b/pdf/pdf.cc
index a4997a582dc35c4ad6dd763ab17dc39e86f05dc5..13ef35585ec134e520e1fee3d3bb7b7e517e92a7 100644
--- a/pdf/pdf.cc
+++ b/pdf/pdf.cc
@@ -199,6 +199,36 @@ bool GetPDFDocInfo(const void* pdf_buffer,
return ret;
}
+// 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 the pdf_buffer in bytes.
Lei Zhang 2014/07/09 21:59:51 the pdf_buffer -> |pdf_buffer|
ivandavid 2014/07/09 22:53:40 Done.
+// |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.
Dan Beam 2014/07/09 22:18:21 ^ I'd say put this doc comment on the interface
ivandavid 2014/07/09 22:53:40 OK. I put the comment in pdf_engine.h PDFEngineExp
+PDF_USED PP_EXPORT
+bool GetPDFPageSizeByIndex(const void* pdf_buffer,
+ int pdf_buffer_size, int page_number,
+ double* width, double* height) {
+ if (!g_sdk_initialized_via_pepper) {
+ void* data = NULL;
+#if defined(OS_WIN)
+ data = g_hmodule;
+#endif
+ if (!chrome_pdf::InitializeSDK(data))
+ return false;
+ }
+ scoped_ptr<chrome_pdf::PDFEngineExports> engine_exports(
+ chrome_pdf::PDFEngineExports::Create());
+ bool ret = engine_exports->GetPDFPageSizeByIndex(
+ pdf_buffer, pdf_buffer_size, page_number, width, height);
+ if (!g_sdk_initialized_via_pepper)
+ chrome_pdf::ShutdownSDK();
+ return ret;
+}
+
// 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.
« no previous file with comments | « no previous file | pdf/pdf_engine.h » ('j') | pdf/pdf_engine.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698