Google云打印票证中的page_range

时间:2015-12-16 23:36:14

标签: javascript google-cloud-print

我尝试编写的程序只使用Google云打印打印文档的第一页。除了page_range之外,我已经获得了所有参数,并且无法解读开发者指南。有人能够告诉我我用于page_range的格式有什么问题吗?我正在使用JavaScript列表

var ticket = {
 version: "1.0",
 print: {
  color: {
    type: "STANDARD_COLOR",
    vendor_id: "Color"
  },
  duplex: {
    type: "NO_DUPLEX"
  },
  copies: {copies: 1},
  media_size: {
     width_microns: 27940,
     height_microns:60960
  },
  page_orientation: {
    type: "LANDSCAPE"  
  },
   margins: {
     top_microns:0,
     bottom_microns:0,
     left_microns:0,
     right_microns:0
  },
  page_range: {
    interval: {
      start:1,
      end:1
    }
  }
 }
};

2 个答案:

答案 0 :(得分:1)

page_range包含名为rake db:migrate的重复字段。它被重复,以便您可以请求多个范围:

interval

PageRange.Interval看起来像这样:

// Ticket item indicating what pages to use.
message PageRangeTicketItem {
  repeated PageRange.Interval interval = 1;
}

因此,请尝试打印第1页和第6-7页:

// Interval of pages in the document to print.
message Interval {
  // Beginning of the interval (inclusive) (required).
  optional int32 start = 1;

  // End of the interval (inclusive). If not set, then the interval will
  // include all available pages after start.
  optional int32 end = 2;
}

答案 1 :(得分:1)

我建议你这样使用

page_range: { interval: [ { start: 1, end: 7 } ] }