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  */
5 
6 /* From dev/ppp_printing_dev.idl modified Wed Jun 13 09:20:40 2012. */
7 
8 #ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_
9 #define PPAPI_C_DEV_PPP_PRINTING_DEV_H_
10 
11 #include "ppapi/c/dev/pp_print_settings_dev.h"
12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_point.h"
16 #include "ppapi/c/pp_rect.h"
17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_size.h"
19 #include "ppapi/c/pp_stdint.h"
20 
21 #define PPP_PRINTING_DEV_INTERFACE_0_6 "PPP_Printing(Dev);0.6"
22 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_6
23 
24 /**
25  * @file
26  * Definition of the PPP_Printing interface.
27  */
28 
29 
30 /**
31  * @addtogroup Structs
32  * @{
33  */
34 /**
35  * Specifies a contiguous range of page numbers to be printed.
36  * The page numbers use a zero-based index.
37  */
38 struct PP_PrintPageNumberRange_Dev {
39   uint32_t first_page_number;
40   uint32_t last_page_number;
41 };
42 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8);
43 /**
44  * @}
45  */
46 
47 /**
48  * @addtogroup Interfaces
49  * @{
50  */
51 struct PPP_Printing_Dev_0_6 {
52   /**
53    *  Returns a bit field representing the supported print output formats.  For
54    *  example, if only PDF and PostScript are supported,
55    *  QuerySupportedFormats returns a value equivalent to:
56    *  (PP_PRINTOUTPUTFORMAT_PDF | PP_PRINTOUTPUTFORMAT_POSTSCRIPT)
57    */
58   uint32_t (*QuerySupportedFormats)(PP_Instance instance);
59   /**
60    * Begins a print session with the given print settings. Calls to PrintPages
61    * can only be made after a successful call to Begin. Returns the number of
62    * pages required for the print output at the given page size (0 indicates
63    * a failure).
64    */
65   int32_t (*Begin)(PP_Instance instance,
66                    const struct PP_PrintSettings_Dev* print_settings);
67   /**
68    * Prints the specified pages using the format specified in Begin.
69    * Returns a PPB_Buffer resource that represents the printed output. Returns
70    * 0 on failure.
71    */
72   PP_Resource (*PrintPages)(
73       PP_Instance instance,
74       const struct PP_PrintPageNumberRange_Dev* page_ranges,
75       uint32_t page_range_count);
76   /** Ends the print session. Further calls to PrintPages will fail. */
77   void (*End)(PP_Instance instance);
78   /**
79    *  Returns true if the current content should be printed into the full page
80    *  and not scaled down to fit within the printer's printable area.
81    */
82   PP_Bool (*IsScalingDisabled)(PP_Instance instance);
83 };
84 
85 typedef struct PPP_Printing_Dev_0_6 PPP_Printing_Dev;
86 /**
87  * @}
88  */
89 
90 #endif  /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */
91 
92