pdf_engine.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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
  3. // found in the LICENSE file.
  4. #ifndef PDF_PDF_ENGINE_H_
  5. #define PDF_PDF_ENGINE_H_
  6. #include <stdint.h>
  7. #include <memory>
  8. #include <string>
  9. #include <vector>
  10. #include "base/callback.h"
  11. #include "base/containers/span.h"
  12. #include "base/time/time.h"
  13. #include "base/values.h"
  14. #include "build/build_config.h"
  15. #include "pdf/document_layout.h"
  16. #include "printing/mojom/print.mojom-forward.h"
  17. #include "third_party/abseil-cpp/absl/types/optional.h"
  18. #include "third_party/skia/include/core/SkColor.h"
  19. #include "ui/base/cursor/mojom/cursor_type.mojom-forward.h"
  20. #include "ui/base/window_open_disposition.h"
  21. #include "ui/gfx/geometry/point_f.h"
  22. #include "ui/gfx/geometry/rect.h"
  23. #include "ui/gfx/geometry/rect_f.h"
  24. #if BUILDFLAG(IS_WIN)
  25. #include <windows.h>
  26. #endif
  27. class SkBitmap;
  28. namespace blink {
  29. class WebInputEvent;
  30. struct WebPrintParams;
  31. } // namespace blink
  32. namespace gfx {
  33. class Point;
  34. class Rect;
  35. class Size;
  36. class SizeF;
  37. class Vector2d;
  38. } // namespace gfx
  39. namespace chrome_pdf {
  40. class Thumbnail;
  41. class UrlLoader;
  42. struct AccessibilityActionData;
  43. struct AccessibilityFocusInfo;
  44. struct AccessibilityLinkInfo;
  45. struct AccessibilityHighlightInfo;
  46. struct AccessibilityImageInfo;
  47. struct AccessibilityTextFieldInfo;
  48. struct AccessibilityTextRunInfo;
  49. struct DocumentAttachmentInfo;
  50. struct DocumentMetadata;
  51. using SendThumbnailCallback = base::OnceCallback<void(Thumbnail)>;
  52. enum class FontMappingMode {
  53. // Do not perform font mapping.
  54. kNoMapping,
  55. // Perform font mapping in renderer processes using Blink/content APIs.
  56. kBlink,
  57. };
  58. enum class DocumentPermission {
  59. kCopy,
  60. kCopyAccessible,
  61. kPrintLowQuality,
  62. kPrintHighQuality,
  63. };
  64. // Do one time initialization of the SDK.
  65. // If `enable_v8` is false, then the PDFEngine will not be able to run
  66. // JavaScript.
  67. void InitializeSDK(bool enable_v8, FontMappingMode font_mapping_mode);
  68. // Tells the SDK that we're shutting down.
  69. void ShutdownSDK();
  70. // This class encapsulates a PDF rendering engine.
  71. class PDFEngine {
  72. public:
  73. // Maximum number of parameters a nameddest view can contain.
  74. static constexpr size_t kMaxViewParams = 4;
  75. enum class FocusFieldType {
  76. // Focus is not on any form field.
  77. kNoFocus,
  78. // Focus is on a form text field or form combobox text field.
  79. kText,
  80. // Focus is on a non-text field.
  81. kNonText,
  82. };
  83. // Named destination in a document.
  84. struct NamedDestination {
  85. // 0-based page number.
  86. unsigned long page;
  87. // View fit type (see table 8.2 "Destination syntax" on page 582 of PDF
  88. // Reference 1.7). Empty string if not present.
  89. std::string view;
  90. // Number of parameters for the view.
  91. unsigned long num_params;
  92. // Parameters for the view. Their meaning depends on the `view` and their
  93. // number is defined by `num_params` but is at most `kMaxViewParams`. Note:
  94. // If a parameter stands for the x/y coordinates, it should be transformed
  95. // into the corresponding in-screen coordinates before it's sent to the
  96. // viewport.
  97. float params[kMaxViewParams];
  98. // A string of parameters for view fit type XYZ in the format of "x,y,zoom",
  99. // where x and y parameters are the in-screen coordinates and zoom is the
  100. // zoom level. If a parameter is "null", then current value of that
  101. // parameter in the viewport should be retained. Note: This string is empty
  102. // if the view's fit type is not XYZ.
  103. std::string xyz_params;
  104. };
  105. // The interface that's provided to the rendering engine.
  106. class Client {
  107. public:
  108. virtual ~Client() = default;
  109. // Proposes a document layout to the client. For the proposed layout to
  110. // become effective, the client must call PDFEngine::ApplyDocumentLayout()
  111. // with the new layout options (although this call can be asynchronous).
  112. virtual void ProposeDocumentLayout(const DocumentLayout& layout) = 0;
  113. // Informs the client that the given rect needs to be repainted.
  114. virtual void Invalidate(const gfx::Rect& rect) {}
  115. // Informs the client to scroll the plugin area by the given offset.
  116. virtual void DidScroll(const gfx::Vector2d& offset) {}
  117. // Scroll the horizontal/vertical scrollbars to a given position.
  118. // Values are in screen coordinates, where 0 is the top/left of the document
  119. // and a positive value is the distance in pixels from that line.
  120. virtual void ScrollToX(int x_screen_coords) {}
  121. virtual void ScrollToY(int y_screen_coords) {}
  122. // Scroll by a given delta relative to the current position.
  123. virtual void ScrollBy(const gfx::Vector2d& delta) {}
  124. // Scroll to zero-based `page`.
  125. virtual void ScrollToPage(int page) {}
  126. // Navigate to the given url.
  127. virtual void NavigateTo(const std::string& url,
  128. WindowOpenDisposition disposition) {}
  129. // Navigate to the given destination. Zero-based `page` index. `x`, `y` and
  130. // `zoom` are optional and can be nullptr.
  131. virtual void NavigateToDestination(int page,
  132. const float* x,
  133. const float* y,
  134. const float* zoom) {}
  135. // Updates the cursor.
  136. virtual void UpdateCursor(ui::mojom::CursorType new_cursor_type) {}
  137. // Updates the tick marks in the vertical scrollbar.
  138. virtual void UpdateTickMarks(const std::vector<gfx::Rect>& tickmarks) {}
  139. // Updates the number of find results for the current search term. If
  140. // there are no matches 0 should be passed in. Only when the plugin has
  141. // finished searching should it pass in the final count with final_result
  142. // set to true.
  143. virtual void NotifyNumberOfFindResultsChanged(int total,
  144. bool final_result) {}
  145. // Updates the index of the currently selected search item.
  146. virtual void NotifySelectedFindResultChanged(int current_find_index) {}
  147. virtual void NotifyTouchSelectionOccurred() {}
  148. // Prompts the user for a password to open this document. The callback is
  149. // called when the password is retrieved.
  150. virtual void GetDocumentPassword(
  151. base::OnceCallback<void(const std::string&)> callback) {}
  152. // Play a "beeping" sound.
  153. virtual void Beep() {}
  154. // Puts up an alert with the given message.
  155. virtual void Alert(const std::string& message) {}
  156. // Puts up a confirm with the given message, and returns true if the user
  157. // presses OK, or false if they press cancel.
  158. virtual bool Confirm(const std::string& message) = 0;
  159. // Puts up a prompt with the given message and default answer and returns
  160. // the answer.
  161. virtual std::string Prompt(const std::string& question,
  162. const std::string& default_answer) = 0;
  163. // Returns the url of the pdf.
  164. virtual std::string GetURL() = 0;
  165. // Send an email.
  166. virtual void Email(const std::string& to,
  167. const std::string& cc,
  168. const std::string& bcc,
  169. const std::string& subject,
  170. const std::string& body) {}
  171. // Put up the print dialog.
  172. virtual void Print() {}
  173. // Submit the data using HTTP POST.
  174. virtual void SubmitForm(const std::string& url,
  175. const void* data,
  176. int length) {}
  177. // Creates and returns new URL loader for partial document requests.
  178. virtual std::unique_ptr<UrlLoader> CreateUrlLoader() = 0;
  179. // Searches the given string for "term" and returns the results. Unicode-
  180. // aware.
  181. struct SearchStringResult {
  182. int start_index;
  183. int length;
  184. };
  185. virtual std::vector<SearchStringResult> SearchString(
  186. const char16_t* string,
  187. const char16_t* term,
  188. bool case_sensitive) = 0;
  189. // Notifies the client that the document has finished loading.
  190. virtual void DocumentLoadComplete() {}
  191. // Notifies the client that the document has failed to load.
  192. virtual void DocumentLoadFailed() {}
  193. // Notifies that an unsupported feature in the PDF was encountered.
  194. virtual void DocumentHasUnsupportedFeature(const std::string& feature) {}
  195. // Notifies the client about document load progress.
  196. virtual void DocumentLoadProgress(uint32_t available, uint32_t doc_size) {}
  197. // Notifies the client about focus changes for form fields.
  198. virtual void FormFieldFocusChange(FocusFieldType type) {}
  199. // Returns true if the plugin has been opened within print preview.
  200. virtual bool IsPrintPreview() const = 0;
  201. // Get the background color of the PDF.
  202. virtual SkColor GetBackgroundColor() = 0;
  203. // Sets selection status.
  204. virtual void SetIsSelecting(bool is_selecting) {}
  205. virtual void SelectionChanged(const gfx::Rect& left,
  206. const gfx::Rect& right) {}
  207. // The caret position in the editable form (if applicable) changed.
  208. virtual void CaretChanged(const gfx::Rect& caret_rect) {}
  209. // Notifies the client that the PDF has been edited.
  210. virtual void EnteredEditMode() {}
  211. // Notifies the client about focus changes for the document.
  212. virtual void DocumentFocusChanged(bool document_has_focus) {}
  213. // Sets selected text.
  214. virtual void SetSelectedText(const std::string& selected_text) = 0;
  215. // Sets the link under cursor.
  216. virtual void SetLinkUnderCursor(const std::string& link_under_cursor) = 0;
  217. // If the link cannot be converted to JS payload struct, then it is not
  218. // possible to pass it to JS. In this case, ignore the link like other PDF
  219. // viewers.
  220. // See https://crbug.com/312882 for an example.
  221. virtual bool IsValidLink(const std::string& url) = 0;
  222. };
  223. virtual ~PDFEngine() = default;
  224. // Most of these functions are similar to the Pepper functions of the same
  225. // name, so not repeating the description here unless it's different.
  226. virtual void PageOffsetUpdated(const gfx::Vector2d& page_offset) = 0;
  227. virtual void PluginSizeUpdated(const gfx::Size& size) = 0;
  228. virtual void ScrolledToXPosition(int position) = 0;
  229. virtual void ScrolledToYPosition(int position) = 0;
  230. // Paint is called a series of times. Before these n calls are made, PrePaint
  231. // is called once. After Paint is called n times, PostPaint is called once.
  232. virtual void PrePaint() = 0;
  233. virtual void Paint(const gfx::Rect& rect,
  234. SkBitmap& image_data,
  235. std::vector<gfx::Rect>& ready,
  236. std::vector<gfx::Rect>& pending) = 0;
  237. virtual void PostPaint() = 0;
  238. virtual bool HandleInputEvent(const blink::WebInputEvent& event) = 0;
  239. virtual void PrintBegin() = 0;
  240. virtual std::vector<uint8_t> PrintPages(
  241. const std::vector<int>& page_numbers,
  242. const blink::WebPrintParams& print_params) = 0;
  243. virtual void PrintEnd() = 0;
  244. virtual void StartFind(const std::string& text, bool case_sensitive) = 0;
  245. virtual bool SelectFindResult(bool forward) = 0;
  246. virtual void StopFind() = 0;
  247. virtual void ZoomUpdated(double new_zoom_level) = 0;
  248. virtual void RotateClockwise() = 0;
  249. virtual void RotateCounterclockwise() = 0;
  250. virtual bool IsReadOnly() const = 0;
  251. virtual void SetReadOnly(bool enable) = 0;
  252. virtual void SetTwoUpView(bool enable) = 0;
  253. virtual void DisplayAnnotations(bool display) = 0;
  254. // Applies the document layout options proposed by a call to
  255. // PDFEngine::Client::ProposeDocumentLayout(), returning the overall size of
  256. // the new effective layout.
  257. virtual gfx::Size ApplyDocumentLayout(
  258. const DocumentLayout::Options& options) = 0;
  259. virtual std::string GetSelectedText() = 0;
  260. // Returns true if focus is within an editable form text area.
  261. virtual bool CanEditText() const = 0;
  262. // Returns true if focus is within an editable form text area and the text
  263. // area has text.
  264. virtual bool HasEditableText() const = 0;
  265. // Replace selected text within an editable form text area with another
  266. // string. If there is no selected text, append the replacement text after the
  267. // current caret position.
  268. virtual void ReplaceSelection(const std::string& text) = 0;
  269. // Methods to check if undo/redo is possible, and to perform them.
  270. virtual bool CanUndo() const = 0;
  271. virtual bool CanRedo() const = 0;
  272. virtual void Undo() = 0;
  273. virtual void Redo() = 0;
  274. // Handles actions invoked by Accessibility clients.
  275. virtual void HandleAccessibilityAction(
  276. const AccessibilityActionData& action_data) = 0;
  277. virtual std::string GetLinkAtPosition(const gfx::Point& point) = 0;
  278. // Checks the permissions associated with this document.
  279. virtual bool HasPermission(DocumentPermission permission) const = 0;
  280. virtual void SelectAll() = 0;
  281. // Gets the list of DocumentAttachmentInfo from the document.
  282. virtual const std::vector<DocumentAttachmentInfo>&
  283. GetDocumentAttachmentInfoList() const = 0;
  284. // Gets the content of an attachment by the attachment's `index`. `index`
  285. // must be in the range of [0, attachment_count-1), where `attachment_count`
  286. // is the number of attachments embedded in the document.
  287. // The caller of this method is responsible for checking whether the
  288. // attachment is readable, attachment size is not 0 byte, and the return
  289. // value's size matches the corresponding DocumentAttachmentInfo's
  290. // `size_bytes`.
  291. virtual std::vector<uint8_t> GetAttachmentData(size_t index) = 0;
  292. // Gets metadata about the document.
  293. virtual const DocumentMetadata& GetDocumentMetadata() const = 0;
  294. // Gets the number of pages in the document.
  295. virtual int GetNumberOfPages() const = 0;
  296. // Gets the named destination by name.
  297. virtual absl::optional<PDFEngine::NamedDestination> GetNamedDestination(
  298. const std::string& destination) = 0;
  299. // Gets the index of the most visible page, or -1 if none are visible.
  300. virtual int GetMostVisiblePage() = 0;
  301. // Gets the rectangle of the page not including the shadow.
  302. virtual gfx::Rect GetPageBoundsRect(int index) = 0;
  303. // Gets the rectangle of the page excluding any additional areas.
  304. virtual gfx::Rect GetPageContentsRect(int index) = 0;
  305. // Returns a page's rect in screen coordinates, as well as its surrounding
  306. // border areas and bottom separator.
  307. virtual gfx::Rect GetPageScreenRect(int page_index) const = 0;
  308. // Set color / grayscale rendering modes.
  309. virtual void SetGrayscale(bool grayscale) = 0;
  310. // Get the number of characters on a given page.
  311. virtual int GetCharCount(int page_index) = 0;
  312. // Get the bounds in page pixels of a character on a given page.
  313. virtual gfx::RectF GetCharBounds(int page_index, int char_index) = 0;
  314. // Get a given unicode character on a given page.
  315. virtual uint32_t GetCharUnicode(int page_index, int char_index) = 0;
  316. // Given a start char index, find the longest continuous run of text that's
  317. // in a single direction and with the same text style. Return a filled out
  318. // AccessibilityTextRunInfo on success or absl::nullopt on failure. e.g. When
  319. // `start_char_index` is out of bounds.
  320. virtual absl::optional<AccessibilityTextRunInfo> GetTextRunInfo(
  321. int page_index,
  322. int start_char_index) = 0;
  323. // For all the links on page `page_index`, get their urls, underlying text
  324. // ranges and bounding boxes.
  325. virtual std::vector<AccessibilityLinkInfo> GetLinkInfo(
  326. int page_index,
  327. const std::vector<AccessibilityTextRunInfo>& text_runs) = 0;
  328. // For all the images in page `page_index`, get their alt texts and bounding
  329. // boxes. If the alt text is empty or unavailable, and if the user has
  330. // requested that the OCR service tag the PDF so that it is made accessible,
  331. // transfer the raw image pixels in the `image_data` field. Otherwise do not
  332. // populate the `image_data` field.
  333. virtual std::vector<AccessibilityImageInfo> GetImageInfo(
  334. int page_index,
  335. uint32_t text_run_count) = 0;
  336. // For all the highlights in page `page_index`, get their underlying text
  337. // ranges and bounding boxes.
  338. virtual std::vector<AccessibilityHighlightInfo> GetHighlightInfo(
  339. int page_index,
  340. const std::vector<AccessibilityTextRunInfo>& text_runs) = 0;
  341. // For all the text fields in page `page_index`, get their properties like
  342. // name, value, bounding boxes etc.
  343. virtual std::vector<AccessibilityTextFieldInfo> GetTextFieldInfo(
  344. int page_index,
  345. uint32_t text_run_count) = 0;
  346. // Gets the PDF document's print scaling preference. True if the document can
  347. // be scaled to fit.
  348. virtual bool GetPrintScaling() = 0;
  349. // Returns number of copies to be printed.
  350. virtual int GetCopiesToPrint() = 0;
  351. // Returns the duplex setting.
  352. virtual printing::mojom::DuplexMode GetDuplexMode() = 0;
  353. // Returns the uniform page size of the document in points. Returns
  354. // `absl::nullopt` if the document has more than one page size.
  355. virtual absl::optional<gfx::Size> GetUniformPageSizePoints() = 0;
  356. // Returns a list of Values of Bookmarks. Each Bookmark is a dictionary Value
  357. // which contains the following key/values:
  358. // - "title" - a string Value.
  359. // - "page" - an int Value.
  360. // - "children" - a list of Values, with each entry containing
  361. // a dictionary Value of the same structure.
  362. virtual base::Value::List GetBookmarks() = 0;
  363. // Append blank pages to make a 1-page document to a `num_pages` document.
  364. // Always retain the first page data.
  365. virtual void AppendBlankPages(size_t num_pages) = 0;
  366. // Append the first page of the document loaded with the `engine` to this
  367. // document at page `index`.
  368. virtual void AppendPage(PDFEngine* engine, int index) = 0;
  369. virtual std::vector<uint8_t> GetSaveData() = 0;
  370. virtual void SetCaretPosition(const gfx::Point& position) = 0;
  371. virtual void MoveRangeSelectionExtent(const gfx::Point& extent) = 0;
  372. virtual void SetSelectionBounds(const gfx::Point& base,
  373. const gfx::Point& extent) = 0;
  374. virtual void GetSelection(uint32_t* selection_start_page_index,
  375. uint32_t* selection_start_char_index,
  376. uint32_t* selection_end_page_index,
  377. uint32_t* selection_end_char_index) = 0;
  378. // Remove focus from form widgets, consolidating the user input.
  379. virtual void KillFormFocus() = 0;
  380. // Notify whether the PDF currently has the focus or not.
  381. virtual void UpdateFocus(bool has_focus) = 0;
  382. // Returns the focus info of current focus item.
  383. virtual AccessibilityFocusInfo GetFocusInfo() = 0;
  384. virtual uint32_t GetLoadedByteSize() = 0;
  385. virtual bool ReadLoadedBytes(uint32_t length, void* buffer) = 0;
  386. // Requests for a thumbnail to be sent using a callback when the page is ready
  387. // to be rendered. `send_callback` is run with the thumbnail data when ready.
  388. virtual void RequestThumbnail(int page_index,
  389. float device_pixel_ratio,
  390. SendThumbnailCallback send_callback) = 0;
  391. };
  392. // Interface for exports that wrap the PDF engine.
  393. class PDFEngineExports {
  394. public:
  395. struct RenderingSettings {
  396. RenderingSettings(const gfx::Size& dpi,
  397. const gfx::Rect& bounds,
  398. bool fit_to_bounds,
  399. bool stretch_to_bounds,
  400. bool keep_aspect_ratio,
  401. bool center_in_bounds,
  402. bool autorotate,
  403. bool use_color,
  404. bool render_for_printing);
  405. RenderingSettings(const RenderingSettings& that);
  406. gfx::Size dpi;
  407. gfx::Rect bounds;
  408. bool fit_to_bounds;
  409. bool stretch_to_bounds;
  410. bool keep_aspect_ratio;
  411. bool center_in_bounds;
  412. bool autorotate;
  413. bool use_color;
  414. bool render_for_printing;
  415. };
  416. PDFEngineExports() {}
  417. virtual ~PDFEngineExports() {}
  418. static PDFEngineExports* Get();
  419. #if BUILDFLAG(IS_CHROMEOS)
  420. // See the definition of CreateFlattenedPdf in pdf.cc for details.
  421. virtual std::vector<uint8_t> CreateFlattenedPdf(
  422. base::span<const uint8_t> input_buffer) = 0;
  423. #endif // BUILDFLAG(IS_CHROMEOS)
  424. #if BUILDFLAG(IS_WIN)
  425. // See the definition of RenderPDFPageToDC in pdf.cc for details.
  426. virtual bool RenderPDFPageToDC(base::span<const uint8_t> pdf_buffer,
  427. int page_number,
  428. const RenderingSettings& settings,
  429. HDC dc) = 0;
  430. virtual void SetPDFUsePrintMode(int mode) = 0;
  431. #endif // BUILDFLAG(IS_WIN)
  432. // See the definition of RenderPDFPageToBitmap in pdf.cc for details.
  433. virtual bool RenderPDFPageToBitmap(base::span<const uint8_t> pdf_buffer,
  434. int page_number,
  435. const RenderingSettings& settings,
  436. void* bitmap_buffer) = 0;
  437. // See the definition of ConvertPdfPagesToNupPdf in pdf.cc for details.
  438. virtual std::vector<uint8_t> ConvertPdfPagesToNupPdf(
  439. std::vector<base::span<const uint8_t>> input_buffers,
  440. size_t pages_per_sheet,
  441. const gfx::Size& page_size,
  442. const gfx::Rect& printable_area) = 0;
  443. // See the definition of ConvertPdfDocumentToNupPdf in pdf.cc for details.
  444. virtual std::vector<uint8_t> ConvertPdfDocumentToNupPdf(
  445. base::span<const uint8_t> input_buffer,
  446. size_t pages_per_sheet,
  447. const gfx::Size& page_size,
  448. const gfx::Rect& printable_area) = 0;
  449. virtual bool GetPDFDocInfo(base::span<const uint8_t> pdf_buffer,
  450. int* page_count,
  451. float* max_page_width) = 0;
  452. // Whether the PDF is Tagged (see 10.7 "Tagged PDF" in PDF Reference 1.7).
  453. // Returns true if it's a tagged (accessible) PDF, false if it's a valid
  454. // PDF but untagged, and nullopt if the PDF can't be parsed.
  455. virtual absl::optional<bool> IsPDFDocTagged(
  456. base::span<const uint8_t> pdf_buffer) = 0;
  457. // Given a tagged PDF (see IsPDFDocTagged, above), return the portion of
  458. // the structure tree for a given page as a hierarchical tree of base::Values.
  459. virtual base::Value GetPDFStructTreeForPage(
  460. base::span<const uint8_t> pdf_buffer,
  461. int page_index) = 0;
  462. // See the definition of GetPDFPageSizeByIndex in pdf.cc for details.
  463. virtual absl::optional<gfx::SizeF> GetPDFPageSizeByIndex(
  464. base::span<const uint8_t> pdf_buffer,
  465. int page_number) = 0;
  466. };
  467. } // namespace chrome_pdf
  468. #endif // PDF_PDF_ENGINE_H_