print_params.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* Copyright 2020 Mozilla Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. class PrintParams {
  16. constructor(data) {
  17. this.binaryOk = true;
  18. this.bitmapDPI = 150;
  19. this.booklet = {
  20. binding: 0,
  21. duplexMode: 0,
  22. subsetFrom: 0,
  23. subsetTo: -1,
  24. };
  25. this.colorOverride = 0;
  26. this.colorProfile = "";
  27. this.constants = Object.freeze({
  28. bookletBindings: Object.freeze({
  29. Left: 0,
  30. Right: 1,
  31. LeftTall: 2,
  32. RightTall: 3,
  33. }),
  34. bookletDuplexMode: Object.freeze({
  35. BothSides: 0,
  36. FrontSideOnly: 1,
  37. BasicSideOnly: 2,
  38. }),
  39. colorOverrides: Object.freeze({
  40. auto: 0,
  41. gray: 1,
  42. mono: 2,
  43. }),
  44. fontPolicies: Object.freeze({
  45. everyPage: 0,
  46. jobStart: 1,
  47. pageRange: 2,
  48. }),
  49. handling: Object.freeze({
  50. none: 0,
  51. fit: 1,
  52. shrink: 2,
  53. tileAll: 3,
  54. tileLarge: 4,
  55. nUp: 5,
  56. booklet: 6,
  57. }),
  58. interactionLevel: Object.freeze({
  59. automatic: 0,
  60. full: 1,
  61. silent: 2,
  62. }),
  63. nUpPageOrders: Object.freeze({
  64. Horizontal: 0,
  65. HorizontalReversed: 1,
  66. Vertical: 2,
  67. }),
  68. printContents: Object.freeze({
  69. doc: 0,
  70. docAndComments: 1,
  71. formFieldsOnly: 2,
  72. }),
  73. flagValues: Object.freeze({
  74. applyOverPrint: 1,
  75. applySoftProofSettings: 1 << 1,
  76. applyWorkingColorSpaces: 1 << 2,
  77. emitHalftones: 1 << 3,
  78. emitPostScriptXObjects: 1 << 4,
  79. emitFormsAsPSForms: 1 << 5,
  80. maxJP2KRes: 1 << 6,
  81. setPageSize: 1 << 7,
  82. suppressBG: 1 << 8,
  83. suppressCenter: 1 << 9,
  84. suppressCJKFontSubst: 1 << 10,
  85. suppressCropClip: 1 << 1,
  86. suppressRotate: 1 << 12,
  87. suppressTransfer: 1 << 13,
  88. suppressUCR: 1 << 14,
  89. useTrapAnnots: 1 << 15,
  90. usePrintersMarks: 1 << 16,
  91. }),
  92. rasterFlagValues: Object.freeze({
  93. textToOutline: 1,
  94. strokesToOutline: 1 << 1,
  95. allowComplexClip: 1 << 2,
  96. preserveOverprint: 1 << 3,
  97. }),
  98. subsets: Object.freeze({
  99. all: 0,
  100. even: 1,
  101. odd: 2,
  102. }),
  103. tileMarks: Object.freeze({
  104. none: 0,
  105. west: 1,
  106. east: 2,
  107. }),
  108. usages: Object.freeze({
  109. auto: 0,
  110. use: 1,
  111. noUse: 2,
  112. }),
  113. });
  114. this.downloadFarEastFonts = false;
  115. this.fileName = "";
  116. this.firstPage = 0;
  117. this.flags = 0;
  118. this.fontPolicy = 0;
  119. this.gradientDPI = 150;
  120. this.interactive = 1;
  121. this.lastPage = data.lastPage;
  122. this.npUpAutoRotate = false;
  123. this.npUpNumPagesH = 2;
  124. this.npUpNumPagesV = 2;
  125. this.npUpPageBorder = false;
  126. this.npUpPageOrder = 0;
  127. this.pageHandling = 0;
  128. this.pageSubset = 0;
  129. this.printAsImage = false;
  130. this.printContent = 0;
  131. this.printerName = "";
  132. this.psLevel = 0;
  133. this.rasterFlags = 0;
  134. this.reversePages = false;
  135. this.tileLabel = false;
  136. this.tileMark = 0;
  137. this.tileOverlap = 0;
  138. this.tileScale = 1.0;
  139. this.transparencyLevel = 75;
  140. this.usePrinterCRD = 0;
  141. this.useT1Conversion = 0;
  142. }
  143. }
  144. export { PrintParams };