How to use TextWidgetAnnotation method in wpt

Best JavaScript code snippet using wpt

annotation_layer_spec.js

Source:annotation_layer_spec.js Github

copy

Full Screen

1/* globals expect, it, describe, Dict, Name, Annotation, AnnotationBorderStyle,2 AnnotationBorderStyleType, AnnotationType, AnnotationFlag, PDFJS,3 beforeEach, afterEach, stringToBytes, AnnotationFactory, Ref, isRef,4 beforeAll, afterAll, AnnotationFieldFlag, stringToUTF8String,5 StringStream, Lexer, Parser */6'use strict';7describe('Annotation layer', function() {8 function XRefMock(array) {9 this.map = Object.create(null);10 for (var elem in array) {11 var obj = array[elem];12 var ref = obj.ref, data = obj.data;13 this.map[ref.toString()] = data;14 }15 }16 XRefMock.prototype = {17 fetch: function (ref) {18 return this.map[ref.toString()];19 },20 fetchIfRef: function (obj) {21 if (!isRef(obj)) {22 return obj;23 }24 return this.fetch(obj);25 },26 };27 var annotationFactory;28 beforeAll(function (done) {29 annotationFactory = new AnnotationFactory();30 done();31 });32 afterAll(function () {33 annotationFactory = null;34 });35 describe('AnnotationFactory', function () {36 it('should get id for annotation', function () {37 var annotationDict = new Dict();38 annotationDict.set('Type', Name.get('Annot'));39 annotationDict.set('Subtype', Name.get('Link'));40 var annotationRef = new Ref(10, 0);41 var xref = new XRefMock([42 { ref: annotationRef, data: annotationDict, }43 ]);44 var annotation = annotationFactory.create(xref, annotationRef);45 var data = annotation.data;46 expect(data.annotationType).toEqual(AnnotationType.LINK);47 expect(data.id).toEqual('10R');48 });49 it('should handle, and get fallback id\'s for, annotations that are not ' +50 'indirect objects (issue 7569)', function () {51 var annotationDict = new Dict();52 annotationDict.set('Type', Name.get('Annot'));53 annotationDict.set('Subtype', Name.get('Link'));54 var xref = new XRefMock();55 var uniquePrefix = 'p0_', idCounters = { obj: 0, };56 var annotation1 = annotationFactory.create(xref, annotationDict,57 uniquePrefix, idCounters);58 var annotation2 = annotationFactory.create(xref, annotationDict,59 uniquePrefix, idCounters);60 var data1 = annotation1.data, data2 = annotation2.data;61 expect(data1.annotationType).toEqual(AnnotationType.LINK);62 expect(data2.annotationType).toEqual(AnnotationType.LINK);63 expect(data1.id).toEqual('annot_p0_1');64 expect(data2.id).toEqual('annot_p0_2');65 });66 it('should handle missing /Subtype', function () {67 var annotationDict = new Dict();68 annotationDict.set('Type', Name.get('Annot'));69 var annotationRef = new Ref(1, 0);70 var xref = new XRefMock([71 { ref: annotationRef, data: annotationDict, }72 ]);73 var annotation = annotationFactory.create(xref, annotationRef);74 var data = annotation.data;75 expect(data.annotationType).toBeUndefined();76 });77 });78 describe('Annotation', function() {79 var dict, ref;80 beforeAll(function (done) {81 dict = new Dict();82 ref = new Ref(1, 0);83 done();84 });85 afterAll(function () {86 dict = ref = null;87 });88 it('should set and get flags', function() {89 var annotation = new Annotation({ dict: dict, ref: ref });90 annotation.setFlags(13);91 expect(annotation.hasFlag(AnnotationFlag.INVISIBLE)).toEqual(true);92 expect(annotation.hasFlag(AnnotationFlag.NOZOOM)).toEqual(true);93 expect(annotation.hasFlag(AnnotationFlag.PRINT)).toEqual(true);94 expect(annotation.hasFlag(AnnotationFlag.READONLY)).toEqual(false);95 });96 it('should be viewable and not printable by default', function() {97 var annotation = new Annotation({ dict: dict, ref: ref });98 expect(annotation.viewable).toEqual(true);99 expect(annotation.printable).toEqual(false);100 });101 it('should set and get a valid rectangle', function() {102 var annotation = new Annotation({ dict: dict, ref: ref });103 annotation.setRectangle([117, 694, 164.298, 720]);104 expect(annotation.rectangle).toEqual([117, 694, 164.298, 720]);105 });106 it('should not set and get an invalid rectangle', function() {107 var annotation = new Annotation({ dict: dict, ref: ref });108 annotation.setRectangle([117, 694, 164.298]);109 expect(annotation.rectangle).toEqual([0, 0, 0, 0]);110 });111 it('should reject a color if it is not an array', function() {112 var annotation = new Annotation({ dict: dict, ref: ref });113 annotation.setColor('red');114 expect(annotation.color).toEqual(new Uint8Array([0, 0, 0]));115 });116 it('should set and get a transparent color', function() {117 var annotation = new Annotation({ dict: dict, ref: ref });118 annotation.setColor([]);119 expect(annotation.color).toEqual(null);120 });121 it('should set and get a grayscale color', function() {122 var annotation = new Annotation({ dict: dict, ref: ref });123 annotation.setColor([0.4]);124 expect(annotation.color).toEqual(new Uint8Array([102, 102, 102]));125 });126 it('should set and get an RGB color', function() {127 var annotation = new Annotation({ dict: dict, ref: ref });128 annotation.setColor([0, 0, 1]);129 expect(annotation.color).toEqual(new Uint8Array([0, 0, 255]));130 });131 it('should set and get a CMYK color', function() {132 var annotation = new Annotation({ dict: dict, ref: ref });133 annotation.setColor([0.1, 0.92, 0.84, 0.02]);134 expect(annotation.color).toEqual(new Uint8Array([233, 59, 47]));135 });136 it('should not set and get an invalid color', function() {137 var annotation = new Annotation({ dict: dict, ref: ref });138 annotation.setColor([0.4, 0.6]);139 expect(annotation.color).toEqual(new Uint8Array([0, 0, 0]));140 });141 });142 describe('AnnotationBorderStyle', function() {143 it('should set and get a valid width', function() {144 var borderStyle = new AnnotationBorderStyle();145 borderStyle.setWidth(3);146 expect(borderStyle.width).toEqual(3);147 });148 it('should not set and get an invalid width', function() {149 var borderStyle = new AnnotationBorderStyle();150 borderStyle.setWidth('three');151 expect(borderStyle.width).toEqual(1);152 });153 it('should set and get a valid style', function() {154 var borderStyle = new AnnotationBorderStyle();155 borderStyle.setStyle(Name.get('D'));156 expect(borderStyle.style).toEqual(AnnotationBorderStyleType.DASHED);157 });158 it('should not set and get an invalid style', function() {159 var borderStyle = new AnnotationBorderStyle();160 borderStyle.setStyle('Dashed');161 expect(borderStyle.style).toEqual(AnnotationBorderStyleType.SOLID);162 });163 it('should set and get a valid dash array', function() {164 var borderStyle = new AnnotationBorderStyle();165 borderStyle.setDashArray([1, 2, 3]);166 expect(borderStyle.dashArray).toEqual([1, 2, 3]);167 });168 it('should not set and get an invalid dash array', function() {169 var borderStyle = new AnnotationBorderStyle();170 borderStyle.setDashArray([0, 0]);171 expect(borderStyle.dashArray).toEqual([3]);172 });173 it('should set and get a valid horizontal corner radius', function() {174 var borderStyle = new AnnotationBorderStyle();175 borderStyle.setHorizontalCornerRadius(3);176 expect(borderStyle.horizontalCornerRadius).toEqual(3);177 });178 it('should not set and get an invalid horizontal corner radius',179 function() {180 var borderStyle = new AnnotationBorderStyle();181 borderStyle.setHorizontalCornerRadius('three');182 expect(borderStyle.horizontalCornerRadius).toEqual(0);183 });184 it('should set and get a valid vertical corner radius', function() {185 var borderStyle = new AnnotationBorderStyle();186 borderStyle.setVerticalCornerRadius(3);187 expect(borderStyle.verticalCornerRadius).toEqual(3);188 });189 it('should not set and get an invalid horizontal corner radius',190 function() {191 var borderStyle = new AnnotationBorderStyle();192 borderStyle.setVerticalCornerRadius('three');193 expect(borderStyle.verticalCornerRadius).toEqual(0);194 });195 });196 describe('LinkAnnotation', function() {197 it('should correctly parse a URI action', function() {198 var actionDict = new Dict();199 actionDict.set('Type', Name.get('Action'));200 actionDict.set('S', Name.get('URI'));201 actionDict.set('URI', 'http://www.ctan.org/tex-archive/info/lshort');202 var annotationDict = new Dict();203 annotationDict.set('Type', Name.get('Annot'));204 annotationDict.set('Subtype', Name.get('Link'));205 annotationDict.set('A', actionDict);206 var annotationRef = new Ref(820, 0);207 var xref = new XRefMock([208 { ref: annotationRef, data: annotationDict, }209 ]);210 var annotation = annotationFactory.create(xref, annotationRef);211 var data = annotation.data;212 expect(data.annotationType).toEqual(AnnotationType.LINK);213 expect(data.url).toEqual('http://www.ctan.org/tex-archive/info/lshort');214 expect(data.dest).toBeUndefined();215 });216 it('should correctly parse a URI action, where the URI entry ' +217 'is missing a protocol', function() {218 var actionDict = new Dict();219 actionDict.set('Type', Name.get('Action'));220 actionDict.set('S', Name.get('URI'));221 actionDict.set('URI', 'www.hmrc.gov.uk');222 var annotationDict = new Dict();223 annotationDict.set('Type', Name.get('Annot'));224 annotationDict.set('Subtype', Name.get('Link'));225 annotationDict.set('A', actionDict);226 var annotationRef = new Ref(353, 0);227 var xref = new XRefMock([228 { ref: annotationRef, data: annotationDict, }229 ]);230 var annotation = annotationFactory.create(xref, annotationRef);231 var data = annotation.data;232 expect(data.annotationType).toEqual(AnnotationType.LINK);233 expect(data.url).toEqual('http://www.hmrc.gov.uk');234 expect(data.dest).toBeUndefined();235 });236 it('should correctly parse a URI action, where the URI entry ' +237 'has an incorrect encoding (bug 1122280)', function () {238 var actionStream = new StringStream(239 '<<\n' +240 '/Type /Action\n' +241 '/S /URI\n' +242 '/URI (http://www.example.com/\\303\\274\\303\\266\\303\\244)\n' +243 '>>\n'244 );245 var lexer = new Lexer(actionStream);246 var parser = new Parser(lexer);247 var actionDict = parser.getObj();248 var annotationDict = new Dict();249 annotationDict.set('Type', Name.get('Annot'));250 annotationDict.set('Subtype', Name.get('Link'));251 annotationDict.set('A', actionDict);252 var annotationRef = new Ref(8, 0);253 var xref = new XRefMock([254 { ref: annotationRef, data: annotationDict, }255 ]);256 var annotation = annotationFactory.create(xref, annotationRef);257 var data = annotation.data;258 expect(data.annotationType).toEqual(AnnotationType.LINK);259 expect(data.url).toEqual(260 stringToUTF8String('http://www.example.com/üöä'));261 expect(data.dest).toBeUndefined();262 });263 it('should correctly parse a GoTo action', function() {264 var actionDict = new Dict();265 actionDict.set('Type', Name.get('Action'));266 actionDict.set('S', Name.get('GoTo'));267 actionDict.set('D', 'page.157');268 var annotationDict = new Dict();269 annotationDict.set('Type', Name.get('Annot'));270 annotationDict.set('Subtype', Name.get('Link'));271 annotationDict.set('A', actionDict);272 var annotationRef = new Ref(798, 0);273 var xref = new XRefMock([274 { ref: annotationRef, data: annotationDict, }275 ]);276 var annotation = annotationFactory.create(xref, annotationRef);277 var data = annotation.data;278 expect(data.annotationType).toEqual(AnnotationType.LINK);279 expect(data.url).toBeUndefined();280 expect(data.dest).toEqual('page.157');281 });282 it('should correctly parse a GoToR action, where the FileSpec entry ' +283 'is a string containing a relative URL', function() {284 var actionDict = new Dict();285 actionDict.set('Type', Name.get('Action'));286 actionDict.set('S', Name.get('GoToR'));287 actionDict.set('F', '../../0013/001346/134685E.pdf');288 actionDict.set('D', '4.3');289 actionDict.set('NewWindow', true);290 var annotationDict = new Dict();291 annotationDict.set('Type', Name.get('Annot'));292 annotationDict.set('Subtype', Name.get('Link'));293 annotationDict.set('A', actionDict);294 var annotationRef = new Ref(489, 0);295 var xref = new XRefMock([296 { ref: annotationRef, data: annotationDict, }297 ]);298 var annotation = annotationFactory.create(xref, annotationRef);299 var data = annotation.data;300 expect(data.annotationType).toEqual(AnnotationType.LINK);301 expect(data.url).toBeUndefined(); // ../../0013/001346/134685E.pdf#4.3302 expect(data.dest).toBeUndefined();303 expect(data.newWindow).toEqual(true);304 });305 it('should correctly parse a GoToR action, with named destination',306 function() {307 var actionDict = new Dict();308 actionDict.set('Type', Name.get('Action'));309 actionDict.set('S', Name.get('GoToR'));310 actionDict.set('F', 'http://www.example.com/test.pdf');311 actionDict.set('D', '15');312 var annotationDict = new Dict();313 annotationDict.set('Type', Name.get('Annot'));314 annotationDict.set('Subtype', Name.get('Link'));315 annotationDict.set('A', actionDict);316 var annotationRef = new Ref(495, 0);317 var xref = new XRefMock([318 { ref: annotationRef, data: annotationDict, }319 ]);320 var annotation = annotationFactory.create(xref, annotationRef);321 var data = annotation.data;322 expect(data.annotationType).toEqual(AnnotationType.LINK);323 expect(data.url).toEqual('http://www.example.com/test.pdf#nameddest=15');324 expect(data.dest).toBeUndefined();325 expect(data.newWindow).toBeFalsy();326 });327 it('should correctly parse a GoToR action, with explicit destination array',328 function() {329 var actionDict = new Dict();330 actionDict.set('Type', Name.get('Action'));331 actionDict.set('S', Name.get('GoToR'));332 actionDict.set('F', 'http://www.example.com/test.pdf');333 actionDict.set('D', [14, Name.get('XYZ'), null, 298.043, null]);334 var annotationDict = new Dict();335 annotationDict.set('Type', Name.get('Annot'));336 annotationDict.set('Subtype', Name.get('Link'));337 annotationDict.set('A', actionDict);338 var annotationRef = new Ref(489, 0);339 var xref = new XRefMock([340 { ref: annotationRef, data: annotationDict, }341 ]);342 var annotation = annotationFactory.create(xref, annotationRef);343 var data = annotation.data;344 expect(data.annotationType).toEqual(AnnotationType.LINK);345 expect(data.url).toEqual('http://www.example.com/test.pdf#' +346 '[14,{"name":"XYZ"},null,298.043,null]');347 expect(data.dest).toBeUndefined();348 expect(data.newWindow).toBeFalsy();349 });350 it('should correctly parse a Named action', function() {351 var actionDict = new Dict();352 actionDict.set('Type', Name.get('Action'));353 actionDict.set('S', Name.get('Named'));354 actionDict.set('N', Name.get('GoToPage'));355 var annotationDict = new Dict();356 annotationDict.set('Type', Name.get('Annot'));357 annotationDict.set('Subtype', Name.get('Link'));358 annotationDict.set('A', actionDict);359 var annotationRef = new Ref(12, 0);360 var xref = new XRefMock([361 { ref: annotationRef, data: annotationDict, }362 ]);363 var annotation = annotationFactory.create(xref, annotationRef);364 var data = annotation.data;365 expect(data.annotationType).toEqual(AnnotationType.LINK);366 expect(data.url).toBeUndefined();367 expect(data.action).toEqual('GoToPage');368 });369 it('should correctly parse a simple Dest', function() {370 var annotationDict = new Dict();371 annotationDict.set('Type', Name.get('Annot'));372 annotationDict.set('Subtype', Name.get('Link'));373 annotationDict.set('Dest', Name.get('LI0'));374 var annotationRef = new Ref(583, 0);375 var xref = new XRefMock([376 { ref: annotationRef, data: annotationDict, }377 ]);378 var annotation = annotationFactory.create(xref, annotationRef);379 var data = annotation.data;380 expect(data.annotationType).toEqual(AnnotationType.LINK);381 expect(data.url).toBeUndefined();382 expect(data.dest).toEqual('LI0');383 });384 });385 describe('TextWidgetAnnotation', function() {386 var textWidgetDict;387 beforeEach(function (done) {388 textWidgetDict = new Dict();389 textWidgetDict.set('Type', Name.get('Annot'));390 textWidgetDict.set('Subtype', Name.get('Widget'));391 textWidgetDict.set('FT', Name.get('Tx'));392 done();393 });394 afterEach(function () {395 textWidgetDict = null;396 });397 it('should handle unknown text alignment, maximum length and flags',398 function() {399 var textWidgetRef = new Ref(124, 0);400 var xref = new XRefMock([401 { ref: textWidgetRef, data: textWidgetDict, }402 ]);403 var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);404 expect(textWidgetAnnotation.data.textAlignment).toEqual(null);405 expect(textWidgetAnnotation.data.maxLen).toEqual(null);406 expect(textWidgetAnnotation.data.readOnly).toEqual(false);407 expect(textWidgetAnnotation.data.multiLine).toEqual(false);408 expect(textWidgetAnnotation.data.comb).toEqual(false);409 });410 it('should not set invalid text alignment, maximum length and flags',411 function() {412 textWidgetDict.set('Q', 'center');413 textWidgetDict.set('MaxLen', 'five');414 textWidgetDict.set('Ff', 'readonly');415 var textWidgetRef = new Ref(43, 0);416 var xref = new XRefMock([417 { ref: textWidgetRef, data: textWidgetDict, }418 ]);419 var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);420 expect(textWidgetAnnotation.data.textAlignment).toEqual(null);421 expect(textWidgetAnnotation.data.maxLen).toEqual(null);422 expect(textWidgetAnnotation.data.readOnly).toEqual(false);423 expect(textWidgetAnnotation.data.multiLine).toEqual(false);424 expect(textWidgetAnnotation.data.comb).toEqual(false);425 });426 it('should set valid text alignment, maximum length and flags',427 function() {428 textWidgetDict.set('Q', 1);429 textWidgetDict.set('MaxLen', 20);430 textWidgetDict.set('Ff', AnnotationFieldFlag.READONLY +431 AnnotationFieldFlag.MULTILINE);432 var textWidgetRef = new Ref(84, 0);433 var xref = new XRefMock([434 { ref: textWidgetRef, data: textWidgetDict, }435 ]);436 var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);437 expect(textWidgetAnnotation.data.textAlignment).toEqual(1);438 expect(textWidgetAnnotation.data.maxLen).toEqual(20);439 expect(textWidgetAnnotation.data.readOnly).toEqual(true);440 expect(textWidgetAnnotation.data.multiLine).toEqual(true);441 });442 it('should reject comb fields without a maximum length', function() {443 textWidgetDict.set('Ff', AnnotationFieldFlag.COMB);444 var textWidgetRef = new Ref(46, 0);445 var xref = new XRefMock([446 { ref: textWidgetRef, data: textWidgetDict, }447 ]);448 var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);449 expect(textWidgetAnnotation.data.comb).toEqual(false);450 });451 it('should accept comb fields with a maximum length', function() {452 textWidgetDict.set('MaxLen', 20);453 textWidgetDict.set('Ff', AnnotationFieldFlag.COMB);454 var textWidgetRef = new Ref(46, 0);455 var xref = new XRefMock([456 { ref: textWidgetRef, data: textWidgetDict, }457 ]);458 var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);459 expect(textWidgetAnnotation.data.comb).toEqual(true);460 });461 it('should only accept comb fields when the flags are valid', function() {462 var invalidFieldFlags = [463 AnnotationFieldFlag.MULTILINE, AnnotationFieldFlag.PASSWORD,464 AnnotationFieldFlag.FILESELECT465 ];466 // Start with all invalid flags set and remove them one by one.467 // The field may only use combs when all invalid flags are unset.468 var flags = AnnotationFieldFlag.COMB + AnnotationFieldFlag.MULTILINE +469 AnnotationFieldFlag.PASSWORD + AnnotationFieldFlag.FILESELECT;470 for (var i = 0, ii = invalidFieldFlags.length; i <= ii; i++) {471 textWidgetDict.set('MaxLen', 20);472 textWidgetDict.set('Ff', flags);473 var textWidgetRef = new Ref(93, 0);474 var xref = new XRefMock([475 { ref: textWidgetRef, data: textWidgetDict, }476 ]);477 var textWidgetAnnotation = annotationFactory.create(xref,478 textWidgetRef);479 var valid = (invalidFieldFlags.length === 0);480 expect(textWidgetAnnotation.data.comb).toEqual(valid);481 // Remove the last invalid flag for the next iteration.482 if (!valid) {483 flags -= invalidFieldFlags.splice(-1, 1);484 }485 }486 });487 });488 describe('FileAttachmentAnnotation', function() {489 var loadingTask;490 var annotations;491 beforeEach(function(done) {492 var pdfUrl = new URL('../pdfs/annotation-fileattachment.pdf',493 window.location).href;494 loadingTask = PDFJS.getDocument(pdfUrl);495 loadingTask.promise.then(function(pdfDocument) {496 return pdfDocument.getPage(1).then(function(pdfPage) {497 return pdfPage.getAnnotations().then(function (pdfAnnotations) {498 annotations = pdfAnnotations;499 done();500 });501 });502 }).catch(function (reason) {503 done.fail(reason);504 });505 });506 afterEach(function() {507 loadingTask.destroy();508 });509 it('should correctly parse a file attachment', function() {510 var annotation = annotations[0];511 expect(annotation.file.filename).toEqual('Test.txt');512 expect(annotation.file.content).toEqual(stringToBytes('Test attachment'));513 });514 });515 describe('PopupAnnotation', function() {516 it('should inherit the parent flags when the Popup is not viewable, ' +517 'but the parent is (PR 7352)', function () {518 var parentDict = new Dict();519 parentDict.set('Type', Name.get('Annot'));520 parentDict.set('Subtype', Name.get('Text'));521 parentDict.set('F', 28); // viewable522 var popupDict = new Dict();523 popupDict.set('Type', Name.get('Annot'));524 popupDict.set('Subtype', Name.get('Popup'));525 popupDict.set('F', 25); // not viewable526 popupDict.set('Parent', parentDict);527 var popupRef = new Ref(13, 0);528 var xref = new XRefMock([529 { ref: popupRef, data: popupDict, }530 ]);531 var popupAnnotation = annotationFactory.create(xref, popupRef);532 var data = popupAnnotation.data;533 expect(data.annotationType).toEqual(AnnotationType.POPUP);534 // Should not modify the `annotationFlags` returned e.g. through the API.535 expect(data.annotationFlags).toEqual(25);536 // The Popup should inherit the `viewable` property of the parent.537 expect(popupAnnotation.viewable).toEqual(true);538 });539 });...

Full Screen

Full Screen

styles.ts

Source:styles.ts Github

copy

Full Screen

1import {css} from 'lit';2export const styles = css`3 /* Copyright 2014 Mozilla Foundation4 *5 * Licensed under the Apache License, Version 2.0 (the "License");6 * you may not use this file except in compliance with the License.7 * You may obtain a copy of the License at8 *9 * http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17 .textLayer {18 position: absolute;19 left: 0;20 top: 0;21 right: 0;22 bottom: 0;23 overflow: hidden;24 opacity: 0.2;25 line-height: 1;26 }27 .textLayer > span {28 color: transparent;29 position: absolute;30 white-space: pre;31 cursor: text;32 -webkit-transform-origin: 0% 0%;33 transform-origin: 0% 0%;34 }35 .textLayer .highlight {36 margin: -1px;37 padding: 1px;38 background-color: rgb(180, 0, 170);39 border-radius: 4px;40 }41 .textLayer .highlight.begin {42 border-radius: 4px 0px 0px 4px;43 }44 .textLayer .highlight.end {45 border-radius: 0px 4px 4px 0px;46 }47 .textLayer .highlight.middle {48 border-radius: 0px;49 }50 .textLayer .highlight.selected {51 background-color: rgb(0, 100, 0);52 }53 .textLayer ::-moz-selection {54 background: rgb(0, 0, 255);55 }56 .textLayer ::selection {57 background: rgb(0, 0, 255);58 }59 .textLayer .endOfContent {60 display: block;61 position: absolute;62 left: 0px;63 top: 100%;64 right: 0px;65 bottom: 0px;66 z-index: -1;67 cursor: default;68 -webkit-user-select: none;69 -moz-user-select: none;70 -ms-user-select: none;71 user-select: none;72 }73 .textLayer .endOfContent.active {74 top: 0px;75 }76 .annotationLayer section {77 position: absolute;78 }79 .annotationLayer .linkAnnotation > a,80 .annotationLayer .buttonWidgetAnnotation.pushButton > a {81 position: absolute;82 font-size: 1em;83 top: 0;84 left: 0;85 width: 100%;86 height: 100%;87 }88 .annotationLayer .linkAnnotation > a:hover,89 .annotationLayer .buttonWidgetAnnotation.pushButton > a:hover {90 opacity: 0.2;91 background: #ff0;92 box-shadow: 0px 2px 10px #ff0;93 }94 .annotationLayer .textAnnotation img {95 position: absolute;96 cursor: pointer;97 }98 .annotationLayer .textWidgetAnnotation input,99 .annotationLayer .textWidgetAnnotation textarea,100 .annotationLayer .choiceWidgetAnnotation select,101 .annotationLayer .buttonWidgetAnnotation.checkBox input,102 .annotationLayer .buttonWidgetAnnotation.radioButton input {103 background-color: rgba(0, 54, 255, 0.13);104 border: 1px solid transparent;105 box-sizing: border-box;106 font-size: 9px;107 height: 100%;108 margin: 0;109 padding: 0 3px;110 vertical-align: top;111 width: 100%;112 }113 .annotationLayer .choiceWidgetAnnotation select option {114 padding: 0;115 }116 .annotationLayer .buttonWidgetAnnotation.radioButton input {117 border-radius: 50%;118 }119 .annotationLayer .textWidgetAnnotation textarea {120 font: message-box;121 font-size: 9px;122 resize: none;123 }124 .annotationLayer .textWidgetAnnotation input[disabled],125 .annotationLayer .textWidgetAnnotation textarea[disabled],126 .annotationLayer .choiceWidgetAnnotation select[disabled],127 .annotationLayer .buttonWidgetAnnotation.checkBox input[disabled],128 .annotationLayer .buttonWidgetAnnotation.radioButton input[disabled] {129 background: none;130 border: 1px solid transparent;131 cursor: not-allowed;132 }133 .annotationLayer .textWidgetAnnotation input:hover,134 .annotationLayer .textWidgetAnnotation textarea:hover,135 .annotationLayer .choiceWidgetAnnotation select:hover,136 .annotationLayer .buttonWidgetAnnotation.checkBox input:hover,137 .annotationLayer .buttonWidgetAnnotation.radioButton input:hover {138 border: 1px solid #000;139 }140 .annotationLayer .textWidgetAnnotation input:focus,141 .annotationLayer .textWidgetAnnotation textarea:focus,142 .annotationLayer .choiceWidgetAnnotation select:focus {143 background: none;144 border: 1px solid transparent;145 }146 .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,147 .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,148 .annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before {149 background-color: #000;150 content: '';151 display: block;152 position: absolute;153 }154 .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,155 .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after {156 height: 80%;157 left: 45%;158 width: 1px;159 }160 .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before {161 -webkit-transform: rotate(45deg);162 transform: rotate(45deg);163 }164 .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after {165 -webkit-transform: rotate(-45deg);166 transform: rotate(-45deg);167 }168 .annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before {169 border-radius: 50%;170 height: 50%;171 left: 30%;172 top: 20%;173 width: 50%;174 }175 .annotationLayer .textWidgetAnnotation input.comb {176 font-family: monospace;177 padding-left: 2px;178 padding-right: 0;179 }180 .annotationLayer .textWidgetAnnotation input.comb:focus {181 /*182 * Letter spacing is placed on the right side of each character. Hence, the183 * letter spacing of the last character may be placed outside the visible184 * area, causing horizontal scrolling. We avoid this by extending the width185 * when the element has focus and revert this when it loses focus.186 */187 width: 115%;188 }189 .annotationLayer .buttonWidgetAnnotation.checkBox input,190 .annotationLayer .buttonWidgetAnnotation.radioButton input {191 -webkit-appearance: none;192 -moz-appearance: none;193 appearance: none;194 padding: 0;195 }196 .annotationLayer .popupWrapper {197 position: absolute;198 width: 20em;199 }200 .annotationLayer .popup {201 position: absolute;202 z-index: 200;203 max-width: 20em;204 background-color: #ffff99;205 box-shadow: 0px 2px 5px #888;206 border-radius: 2px;207 padding: 6px;208 margin-left: 5px;209 cursor: pointer;210 font: message-box;211 font-size: 9px;212 word-wrap: break-word;213 }214 .annotationLayer .popup > * {215 font-size: 9px;216 }217 .annotationLayer .popup h1 {218 display: inline-block;219 }220 .annotationLayer .popup span {221 display: inline-block;222 margin-left: 5px;223 }224 .annotationLayer .popup p {225 border-top: 1px solid #333;226 margin-top: 2px;227 padding-top: 2px;228 }229 .annotationLayer .highlightAnnotation,230 .annotationLayer .underlineAnnotation,231 .annotationLayer .squigglyAnnotation,232 .annotationLayer .strikeoutAnnotation,233 .annotationLayer .freeTextAnnotation,234 .annotationLayer .lineAnnotation svg line,235 .annotationLayer .squareAnnotation svg rect,236 .annotationLayer .circleAnnotation svg ellipse,237 .annotationLayer .polylineAnnotation svg polyline,238 .annotationLayer .polygonAnnotation svg polygon,239 .annotationLayer .caretAnnotation,240 .annotationLayer .inkAnnotation svg polyline,241 .annotationLayer .stampAnnotation,242 .annotationLayer .fileAttachmentAnnotation {243 cursor: pointer;244 }245 .pdfViewer .canvasWrapper {246 overflow: hidden;247 }248 .pdfViewer .page {249 direction: ltr;250 width: 816px;251 height: 1056px;252 margin: 1px auto -8px auto;253 position: relative;254 overflow: visible;255 border: 9px solid transparent;256 background-clip: content-box;257 -webkit-border-image: url(images/shadow.png) 9 9 repeat;258 -o-border-image: url(images/shadow.png) 9 9 repeat;259 border-image: url(images/shadow.png) 9 9 repeat;260 background-color: white;261 }262 .pdfViewer.removePageBorders .page {263 margin: 0px auto 10px auto;264 border: none;265 }266 .pdfViewer.singlePageView {267 display: inline-block;268 }269 .pdfViewer.singlePageView .page {270 margin: 0;271 border: none;272 }273 .pdfViewer.scrollHorizontal,274 .pdfViewer.scrollWrapped,275 .spread {276 margin-left: 3.5px;277 margin-right: 3.5px;278 text-align: center;279 }280 .pdfViewer.scrollHorizontal,281 .spread {282 white-space: nowrap;283 }284 .pdfViewer.removePageBorders,285 .pdfViewer.scrollHorizontal .spread,286 .pdfViewer.scrollWrapped .spread {287 margin-left: 0;288 margin-right: 0;289 }290 .spread .page,291 .pdfViewer.scrollHorizontal .page,292 .pdfViewer.scrollWrapped .page,293 .pdfViewer.scrollHorizontal .spread,294 .pdfViewer.scrollWrapped .spread {295 display: inline-block;296 vertical-align: middle;297 }298 .spread .page,299 .pdfViewer.scrollHorizontal .page,300 .pdfViewer.scrollWrapped .page {301 margin-left: -3.5px;302 margin-right: -3.5px;303 }304 .pdfViewer.removePageBorders .spread .page,305 .pdfViewer.removePageBorders.scrollHorizontal .page,306 .pdfViewer.removePageBorders.scrollWrapped .page {307 margin-left: 5px;308 margin-right: 5px;309 }310 .pdfViewer .page canvas {311 margin: 0;312 display: block;313 }314 .pdfViewer .page canvas[hidden] {315 display: none;316 }317 .pdfViewer .page .loadingIcon {318 position: absolute;319 display: block;320 left: 0;321 top: 0;322 right: 0;323 bottom: 0;324 background: url('images/loading-icon.gif') center no-repeat;325 }326 .pdfPresentationMode .pdfViewer {327 margin-left: 0;328 margin-right: 0;329 }330 .pdfPresentationMode .pdfViewer .page,331 .pdfPresentationMode .pdfViewer .spread {332 display: block;333 }334 .pdfPresentationMode .pdfViewer .page,335 .pdfPresentationMode .pdfViewer.removePageBorders .page {336 margin-left: auto;337 margin-right: auto;338 }339 .pdfPresentationMode:-ms-fullscreen .pdfViewer .page {340 margin-bottom: 100% !important;341 }342 .pdfPresentationMode:-webkit-full-screen .pdfViewer .page {343 margin-bottom: 100%;344 border: 0;345 }346 .pdfPresentationMode:-moz-full-screen .pdfViewer .page {347 margin-bottom: 100%;348 border: 0;349 }350 .pdfPresentationMode:fullscreen .pdfViewer .page {351 margin-bottom: 100%;352 border: 0;353 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var myDoc = app.activeDocument;2var myPage = myDoc.pages.item(0);3var myRect = myPage.rectangles.add({geometricBounds:[72,72,144,144]});4var myTextFrame = myPage.textFrames.add({geometricBounds:[72,72,144,144]});5myTextFrame.contents = "This is a text widget annotation";6var myTextWidgetAnnotation = myPage.textWidgetAnnotations.add({geometricBounds:[72,72,144,144],textFrame:myTextFrame});7myTextWidgetAnnotation.name = "My Text Widget Annotation";8myTextWidgetAnnotation.fillColor = "None";9myTextWidgetAnnotation.strokeColor = "None";10myTextWidgetAnnotation.textWidgetAnnotationType = TextWidgetAnnotationTypes.text;11myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.off;12myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.nextPage;13myTextWidgetAnnotation.rotationAngle = 45;14myTextWidgetAnnotation.move(myPage, ElementPlacement.PLACEATBEGINNING);15myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.on;16myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.previousPage;17myTextWidgetAnnotation.rotationAngle = 0;18myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.off;19myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.nextPage;20myTextWidgetAnnotation.rotationAngle = 45;21myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.on;22myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.previousPage;23myTextWidgetAnnotation.rotationAngle = 0;24myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.off;25myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.nextPage;26myTextWidgetAnnotation.rotationAngle = 45;27myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.on;28myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.previousPage;29myTextWidgetAnnotation.rotationAngle = 0;30myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.off;31myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.nextPage;32myTextWidgetAnnotation.rotationAngle = 45;33myTextWidgetAnnotation.textWidgetAnnotationState = TextWidgetAnnotationStates.on;34myTextWidgetAnnotation.textWidgetAnnotationAction = TextWidgetAnnotationActions.previousPage;

Full Screen

Using AI Code Generation

copy

Full Screen

1const { PDFDocument } = require('pdf-lib');2const fs = require('fs');3const path = require('path');4const pdfDoc = await PDFDocument.load(fs.readFileSync(path.join(__dirname, 'test.pdf')));5const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica);6const pages = pdfDoc.getPages();7const firstPage = pages[0];8const { width, height } = firstPage.getSize();9const widgetAnnotation = firstPage.getAnnotations()[0];10const widgetAnnotationRef = widgetAnnotation.ref;11const widgetAnnotationDict = widgetAnnotation.getUnfilteredDict();12const widgetAnnotationField = widgetAnnotationDict.lookup(PDFName.of('T'));13const widgetAnnotationTextWidget = widgetAnnotationDict.lookup(PDFName.of('Subtype'));14const widgetAnnotationTextWidgetRef = widgetAnnotationTextWidget.ref;15const widgetAnnotationTextWidgetDict = widgetAnnotationTextWidget.getUnfilteredDict();16const widgetAnnotationTextWidgetField = widgetAnnotationTextWidgetDict.lookup(PDFName.of('T'));17console.log("widgetAnnotationField: ", widgetAnnotationField);18console.log("widgetAnnotationTextWidgetField: ", widgetAnnotationTextWidgetField);19const textWidgetAnnotation = await firstPage.addTextWidgetAnnotation({20 textColor: rgb(0, 0, 0),21 backgroundColor: rgb(1, 1, 1),22 borderColor: rgb(0, 0, 0),

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = this.getPageNum();2var annot = this.addAnnot({3});4annot.setFlags([annotFlagHidden]);5annot.setFlags([annotFlagInvisible]);6annot.setFlags([annotFlagNoZoom]);7annot.setFlags([annotFlagNoRotate]);8annot.setFlags([annotFlagNoView]);9annot.setFlags([annotFlagReadOnly]);10annot.setFlags([annotFlagLocked]);11annot.setFlags([annotFlagToggleNoView]);12annot.setFlags([annotFlagLockedContents]);13var flags = annot.getFlags();14for (var i = 0; i < flags.length; i++) {15 console.println(flags[i]);16}17annot.setAppearanceState("Off");18annot.setAppearanceState("On");19var state = annot.getAppearanceState();20console.println(state);21annot.setAppearanceStream("Off", "0 0 0 rg");22annot.setAppearanceStream("On", "0 0 0 rg");23var stream = annot.getAppearanceStream("Off");24console.println(stream);25stream = annot.getAppearanceStream("On");26console.println(stream);27annot.setDefaultAppearance("0 0 0 rg");28var defaultAppearance = annot.getDefaultAppearance();29console.println(defaultAppearance);30annot.setRichText("This is a rich text");31var richText = annot.getRichText();32console.println(richText);33annot.setRichText("This is a rich text", "text/html");34richText = annot.getRichText();35console.println(richText);36annot.setRichText("This is a rich text", "text/plain");37richText = annot.getRichText();38console.println(richText);39annot.setRichText("This is a rich text", "application/xhtml+xml");40richText = annot.getRichText();41console.println(richText);42annot.setRichText("This is a rich text", "application/xml");43richText = annot.getRichText();44console.println(richText);45annot.setRichText("This is a rich text", "text/xml");46richText = annot.getRichText();47console.println(richText);48annot.setRichText("This is a rich text", "text/richtext");49richText = annot.getRichText();50console.println(richText);51annot.setRichText("This is a rich text", "text/enriched");52richText = annot.getRichText();

Full Screen

Using AI Code Generation

copy

Full Screen

1var textwidgetannotation = require('com.mcongrove.wptextwidgetannotation');2var win = Ti.UI.createWindow({3});4var textWidget = textwidgetannotation.createTextWidgetAnnotation({5 font: {6 }7});8win.add(textWidget);9win.open();

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidgetAnnotation = new TextWidgetAnnotation();2textWidgetAnnotation.setText("Hello World!");3textWidgetAnnotation.setPage(0);4textWidgetAnnotation.setRect([100, 100, 200, 200]);5textWidgetAnnotation.setColor([1, 0, 0]);6textWidgetAnnotation.setOpacity(0.5);7textWidgetAnnotation.setReadOnly(true);8textWidgetAnnotation.setOpen(true);9textWidgetAnnotation.setMultiline(true);10textWidgetAnnotation.setComb(false);11textWidgetAnnotation.setRichText(false);12textWidgetAnnotation.setMaxLength(0);13textWidgetAnnotation.setScroll(true);14textWidgetAnnotation.setSpellCheck(true);15textWidgetAnnotation.setDoNotScroll(false);16textWidgetAnnotation.setDoNotSpellCheck(false);17textWidgetAnnotation.setComb(false);18textWidgetAnnotation.setNoExport(false);19textWidgetAnnotation.setPrint(false);20textWidgetAnnotation.setNoRotate(false);21textWidgetAnnotation.setNoZoom(false);22textWidgetAnnotation.setNoView(false);23textWidgetAnnotation.setReadOnly(false);24textWidgetAnnotation.setLocked(false);25textWidgetAnnotation.setToggleNoView(false);26textWidgetAnnotation.setLockedContents(false);27textWidgetAnnotation.setInvisible(false);28textWidgetAnnotation.setHidden(false);29textWidgetAnnotation.setPrinted(false);30textWidgetAnnotation.setSubmitForm(false);31textWidgetAnnotation.setResetForm(false);32textWidgetAnnotation.setRequired(false);33textWidgetAnnotation.setNoToggleToOff(false);34textWidgetAnnotation.setRadio(false);35textWidgetAnnotation.setPushbutton(false);36textWidgetAnnotation.setRadiosInUnison(false);37textWidgetAnnotation.setExportValue("Hello World!");38textWidgetAnnotation.setFieldName("Hello World!");39textWidgetAnnotation.setAlternateFieldName("Hello World!");40textWidgetAnnotation.setMappingName("Hello World!");41textWidgetAnnotation.setTooltip("Hello World!");42textWidgetAnnotation.setCMapName("Hello World!");43textWidgetAnnotation.setDA("Hello World!");44textWidgetAnnotation.setQ(0);45textWidgetAnnotation.setDV("Hello World!");46textWidgetAnnotation.setRV("Hello World!");47textWidgetAnnotation.setA("Hello World!");48textWidgetAnnotation.setAA("Hello World!");49textWidgetAnnotation.setOpt("Hello World!");50textWidgetAnnotation.setTI("Hello World!");51textWidgetAnnotation.setI(0);52textWidgetAnnotation.setMK("Hello World!");53textWidgetAnnotation.setBS("Hello World!");54textWidgetAnnotation.setBE("Hello World!");55textWidgetAnnotation.setRD("Hello World!");56textWidgetAnnotation.setStructParent(0);57textWidgetAnnotation.setOC("Hello World

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = this.getPageNum();2var annots = this.getAnnots(page);3for (var i = 0; i < annots.length; i++) {4var annot = annots[i];5if (annot.type == "Text") {6var text = annot.getText();7console.println(text);8}9}

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidget = this.getField("textWidget");2textWidget.setText("Hello World");3event.rc = false;4var buttonWidget = this.getField("buttonWidget");5buttonWidget.setCaption("Hello World");6event.rc = false;7var checkBoxWidget = this.getField("checkBoxWidget");8checkBoxWidget.setCaption("Hello World");9event.rc = false;10var comboBoxWidget = this.getField("comboBoxWidget");11comboBoxWidget.setCaption("Hello World");12event.rc = false;13var listBoxWidget = this.getField("listBoxWidget");14listBoxWidget.setCaption("Hello World");15event.rc = false;16var radioButtonWidget = this.getField("radioButtonWidget");17radioButtonWidget.setCaption("Hello World");18event.rc = false;19var comboBoxWidget = this.getField("comboBoxWidget");20comboBoxWidget.addItem("Hello World");21event.rc = false;22var listBoxWidget = this.getField("listBoxWidget");23listBoxWidget.addItem("Hello World");24event.rc = false;25var radioButtonWidget = this.getField("radioButtonWidget");26radioButtonWidget.addItem("Hello World");27event.rc = false;28var comboBoxWidget = this.getField("comboBoxWidget");29comboBoxWidget.removeItem("Hello World");30event.rc = false;31var listBoxWidget = this.getField("listBoxWidget");32listBoxWidget.removeItem("Hello World");33event.rc = false;

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidget = new TextWidgetAnnotation();2textWidget.setText("Hello World");3textWidget.setFontSize(12);4textWidget.setFontColor(0, 0, 1);5textWidget.setFont("Helvetica");6textWidget.setPos(100, 100);7textWidget.draw();81. Fork it (

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidget = new TextWidgetAnnotation();2textWidget.page = this.pageNum;3textWidget.rect = [this.pageNum.width/2, this.pageNum.height/2, 100, 100];4textWidget.color = color.red;5textWidget.opacity = 0.5;6textWidget.value = "This is a text widget annotation";7textWidget.drawOnPage(this.pageNum);

Full Screen

Using AI Code Generation

copy

Full Screen

1var widget = this.getField("TextWidget");2widget.textSize = 20;3widget.textColor = color.blue;4widget.fillColor = color.yellow;5widget.strokeColor = color.red;6widget.borderWidth = 5;7widget.borderColor = color.blue;8widget.rotation = 180;9widget.multiline = true;10widget.richText = true;11widget.comb = true;12widget.combLength = 10;13widget.password = true;14widget.maxLen = 10;15widget.readOnly = true;16widget.noExport = true;17widget.hidden = true;18widget.buttonAlignX = 0.5;19widget.buttonAlignY = 0.5;20widget.buttonScaleHow = 1;21widget.buttonScaleWhen = 1;22widget.buttonIconFitBounds = [0, 0, 100, 100];23widget.buttonPosition = 1;24widget.buttonFitBounds = [0, 0, 100, 100];25widget.buttonCaption = "Button Caption";26widget.buttonIcon = this.getIcon("Help");27widget.buttonIconName = "Help";28widget.buttonIconType = 1;29widget.buttonExportValue = "Button Export Value";30widget.buttonRollOverCaption = "Button Roll Over Caption";31widget.buttonDownCaption = "Button Down Caption";32widget.buttonRollOverIcon = this.getIcon("Help");33widget.buttonDownIcon = this.getIcon("Help");34widget.buttonIconFit = 1;35widget.buttonScale = 1;36widget.buttonBorderStyle = 0;37widget.buttonBorderColor = color.red;38widget.buttonBackgroundColor = color.blue;39widget.buttonHighlightColor = color.yellow;40widget.buttonDownColor = color.green;41widget.buttonTextColor = color.black;42widget.buttonBorderColor2 = color.red;43widget.buttonBackgroundColor2 = color.blue;44widget.buttonHighlightColor2 = color.yellow;45widget.buttonDownColor2 = color.green;46widget.buttonTextColor2 = color.black;47widget.buttonBorderWidth = 5;48widget.buttonBorderStyle = 1;49widget.buttonXOffset = 10;50widget.buttonYOffset = 10;51widget.buttonCaptionOffset = 10;52widget.buttonIconOffset = 10;53widget.buttonTextPosition = 1;54widget.buttonTextAlign = 1;55widget.buttonIconPosition = 1;56widget.buttonScaleType = 1;57widget.buttonIconFitToBounds = false;58widget.buttonIconFitToScale = false;59widget.buttonFitToBounds = false;60widget.buttonFitToScale = false;61textWidgetAnnotation.setCMapName("Hello World!");62textWidgetAnnotation.setDA("Hello World!");63textWidgetAnnotation.setQ(0);64textWidgetAnnotation.setDV("Hello World!");65textWidgetAnnotation.setRV("Hello World!");66textWidgetAnnotation.setA("Hello World!");67textWidgetAnnotation.setAA("Hello World!");68textWidgetAnnotation.setOpt("Hello World!");69textWidgetAnnotation.setTI("Hello World!");70textWidgetAnnotation.setI(0);71textWidgetAnnotation.setMK("Hello World!");72textWidgetAnnotation.setBS("Hello World!");73textWidgetAnnotation.setBE("Hello World!");74textWidgetAnnotation.setRD("Hello World!");75textWidgetAnnotation.setStructParent(0);76textWidgetAnnotation.setOC("Hello World

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = this getPageNum();2var annots = this.getAnnots(page);3for (var i = 0; i < annots.length; i++) {4var annot = annots[i];5if (annot.type == "Text") {6var text = annot.getText();7console.println(text);8}9}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { PDFDocument } = require('pdf-lib');2const fs = require('fs');3const path = require('path');4const pdfDoc = await PDFDocument.load(fs.readFileSync(path.join(__dirname, 'test.pdf')));5const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica);6const pages = pdfDoc.getPages();7const firstPage = pages[0];8const { width, height } = firstPage.getSize();9const widgetAnnotation = firstPage.getAnnotations()[0];10const widgetAnnotationRef = widgetAnnotation.ref;11const widgetAnnotationDict = widgetAnnotation.getUnfilteredDict();12const widgetAnnotationField = widgetAnnotationDict.lookup(PDFName.of('T'));13const widgetAnnotationTextWidget = widgetAnnotationDict.lookup(PDFName.of('Subtype'));14const widgetAnnotationTextWidgetRef = widgetAnnotationTextWidget.ref;15const widgetAnnotationTextWidgetDict = widgetAnnotationTextWidget.getUnfilteredDict();16const widgetAnnotationTextWidgetField = widgetAnnotationTextWidgetDict.lookup(PDFName.of('T'));17console.log("widgetAnnotationField: ", widgetAnnotationField);18console.log("widgetAnnotationTextWidgetField: ", widgetAnnotationTextWidgetField);19const textWidgetAnnotation = await firstPage.addTextWidgetAnnotation({20 text: 'Hello World!',um);

Full Screen

Using AI Code Generation

copy

Full Screen

1var widget = this.getField("TextWidget";2widget.textSize = 20;3widget.textColor = color.blue;4widget.strokeColor = color.red;5widget.borderWidth = 5;6widget.borderColor = color.blue;7widget.rotation = 180;8widget.multiline = true;9widget.richText = true;10widget.comb = true;11widget.combLength = 10;12widget.password = true;13widget.maxLen = 10;14widget.readOnly = true;15widget.noExport = true;16widget.hidden = true;17widget.buttonAlignX = 0.5;18widget.buttonAlignY = 0.5;19widget.buttonScaleHow = 1;20widget.buttonScaleWhen = 1;21widget.buttonIconFitBounds = [0, 0, 100, 100];22widget.buttonPosition = 1;23widget.buttonFitBounds = [0, 0, 100, 100];24widget.buttonCaption = "Button Caption";25widget.buttonIcon = this.getIcon("Help");26widget.buttonIconName = "Help";27widget.buttonIconType = 1;28widget.buttonExportValue = "Button Export Value";29widget.buttonRollOverCaption = "Button Roll Over Caption";30widget.buttonDownCaption = "Button Down Caption";31widget.buttonRollOverIcon = this.getIcon("Help");32widget.buttonDownIcon = this.getIcon("Help");33widget.buttonIconFit = 1;34widget.buttonScale = 1;35widget.buttonBorderStyle = 0;36widget.buttonBorderColor = color.red;37widget.buttonBackgroundColor = color.blue;38widget.buttonHighlightColor = color.yellow;39widget.buttonDownColor = color.green;40widget.buttonTextColor = color.black;41widget.buttonBorderColor2 = color.red;42widget.buttonBackgroundColor2 = color.blue;43widget.buttonHighlightColor2 = color.yellow;44widget.buttonDownColor2 = color.green;45widget.buttonTextColor2 = color.black;46widget.buttonBorderWidth = 5;47widget.buttonBorderStyle = 1;48widget.buttonXOffset = 10;49widget.buttonYOffset = 10;50widget.buttonCaptionOffset = 10;51widget.buttonIconOffset = 10;52widget.buttonTextPosition = 1;53widget.buttonTextAlign = 1;54widget.buttonIconPosition = 1;55widget.buttonScaleType = 1;56widget.buttonIconFitToBounds = false;57widget.buttonIconFitToScale = false;58widget.buttonFitToBounds = false;59widget.buttonFitToScale = false;60 textColor: rgb(0, 0, 0),61 backgroundColor: rgb(1, 1, 1),62 borderColor: rgb(0, 0, 0),

Full Screen

Using AI Code Generation

copy

Full Screen

1var textwidgetannotation = require('com.mcongrove.wptextwidgetannotation');2var win = Ti.UI.createWindow({3});4var textWidget = textwidgetannotation.createTextWidgetAnnotation({5 font: {6 }7});8win.add(textWidget);9win.open();

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidgetAnnotation = new TextWidgetAnnotation();2textWidgetAnnotation.setText("Hello World!");3textWidgetAnnotation.setPage(0);4textWidgetAnnotation.setRect([100, 100, 200, 200]);5textWidgetAnnotation.setColor([1, 0, 0]);6textWidgetAnnotation.setOpacity(0.5);7textWidgetAnnotation.setReadOnly(true);8textWidgetAnnotation.setOpen(true);9textWidgetAnnotation.setMultiline(true);10textWidgetAnnotation.setComb(false);11textWidgetAnnotation.setRichText(false);12textWidgetAnnotation.setMaxLength(0);13textWidgetAnnotation.setScroll(true);14textWidgetAnnotation.setSpellCheck(true);15textWidgetAnnotation.setDoNotScroll(false);16textWidgetAnnotation.setDoNotSpellCheck(false);17textWidgetAnnotation.setComb(false);18textWidgetAnnotation.setNoExport(false);19textWidgetAnnotation.setPrint(false);20textWidgetAnnotation.setNoRotate(false);21textWidgetAnnotation.setNoZoom(false);22textWidgetAnnotation.setNoView(false);23textWidgetAnnotation.setReadOnly(false);24textWidgetAnnotation.setLocked(false);25textWidgetAnnotation.setToggleNoView(false);26textWidgetAnnotation.setLockedContents(false);27textWidgetAnnotation.setInvisible(false);28textWidgetAnnotation.setHidden(false);29textWidgetAnnotation.setPrinted(false);30textWidgetAnnotation.setSubmitForm(false);31textWidgetAnnotation.setResetForm(false);32textWidgetAnnotation.setRequired(false);33textWidgetAnnotation.setNoToggleToOff(false);34textWidgetAnnotation.setRadio(false);35textWidgetAnnotation.setPushbutton(false);36textWidgetAnnotation.setRadiosInUnison(false);37textWidgetAnnotation.setExportValue("Hello World!");38textWidgetAnnotation.setFieldName("Hello World!");39textWidgetAnnotation.setAlternateFieldName("Hello World!");40textWidgetAnnotation.setMappingName("Hello World!");41textWidgetAnnotation.setTooltip("Hello World!");42textWidgetAnnotation.setCMapName("Hello World!");43textWidgetAnnotation.setDA("Hello World!");44textWidgetAnnotation.setQ(0);45textWidgetAnnotation.setDV("Hello World!");46textWidgetAnnotation.setRV("Hello World!");47textWidgetAnnotation.setA("Hello World!");48textWidgetAnnotation.setAA("Hello World!");49textWidgetAnnotation.setOpt("Hello World!");50textWidgetAnnotation.setTI("Hello World!");51textWidgetAnnotation.setI(0);52textWidgetAnnotation.setMK("Hello World!");53textWidgetAnnotation.setBS("Hello World!");54textWidgetAnnotation.setBE("Hello World!");55textWidgetAnnotation.setRD("Hello World!");56textWidgetAnnotation.setStructParent(0);57textWidgetAnnotation.setOC("Hello World

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = this.getPageNum();2var annots = this.getAnnots(page);3for (var i = 0; i < annots.length; i++) {4var annot = annots[i];5if (annot.type == "Text") {6var text = annot.getText();7console.println(text);8}9}

Full Screen

Using AI Code Generation

copy

Full Screen

1var textwidgetannotation = require('com.mcongrove.wptextwidgetannotation');2var win = Ti.UI.createWindow({3});4var textWidget = textwidgetannotation.createTextWidgetAnnotation({5 font: {6 }7});8win.add(textWidget);9win.open();

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidgetAnnotation = new TextWidgetAnnotation();2textWidgetAnnotation.setText("Hello World!");3textWidgetAnnotation.setPage(0);4textWidgetAnnotation.setRect([100, 100, 200, 200]);5textWidgetAnnotation.setColor([1, 0, 0]);6textWidgetAnnotation.setOpacity(0.5);7textWidgetAnnotation.setReadOnly(true);8textWidgetAnnotation.setOpen(true);9textWidgetAnnotation.setMultiline(true);10textWidgetAnnotation.setComb(false);11textWidgetAnnotation.setRichText(false);12textWidgetAnnotation.setMaxLength(0);13textWidgetAnnotation.setScroll(true);14textWidgetAnnotation.setSpellCheck(true);15textWidgetAnnotation.setDoNotScroll(false);16textWidgetAnnotation.setDoNotSpellCheck(false);17textWidgetAnnotation.setComb(false);18textWidgetAnnotation.setNoExport(false);19textWidgetAnnotation.setPrint(false);20textWidgetAnnotation.setNoRotate(false);21textWidgetAnnotation.setNoZoom(false);22textWidgetAnnotation.setNoView(false);23textWidgetAnnotation.setReadOnly(false);24textWidgetAnnotation.setLocked(false);25textWidgetAnnotation.setToggleNoView(false);26textWidgetAnnotation.setLockedContents(false);27textWidgetAnnotation.setInvisible(false);28textWidgetAnnotation.setHidden(false);29textWidgetAnnotation.setPrinted(false);30textWidgetAnnotation.setSubmitForm(false);31textWidgetAnnotation.setResetForm(false);32textWidgetAnnotation.setRequired(false);33textWidgetAnnotation.setNoToggleToOff(false);34textWidgetAnnotation.setRadio(false);35textWidgetAnnotation.setPushbutton(false);36textWidgetAnnotation.setRadiosInUnison(false);37textWidgetAnnotation.setExportValue("Hello World!");38textWidgetAnnotation.setFieldName("Hello World!");39textWidgetAnnotation.setAlternateFieldName("Hello World!");40textWidgetAnnotation.setMappingName("Hello World!");41textWidgetAnnotation.setTooltip("Hello World!");42textWidgetAnnotation.setCMapName("Hello World!");43textWidgetAnnotation.setDA("Hello World!");44textWidgetAnnotation.setQ(0);45textWidgetAnnotation.setDV("Hello World!");46textWidgetAnnotation.setRV("Hello World!");47textWidgetAnnotation.setA("Hello World!");48textWidgetAnnotation.setAA("Hello World!");49textWidgetAnnotation.setOpt("Hello World!");50textWidgetAnnotation.setTI("Hello World!");51textWidgetAnnotation.setI(0);52textWidgetAnnotation.setMK("Hello World!");53textWidgetAnnotation.setBS("Hello World!");54textWidgetAnnotation.setBE("Hello World!");55textWidgetAnnotation.setRD("Hello World!");56textWidgetAnnotation.setStructParent(0);57textWidgetAnnotation.setOC("Hello World

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = this.getPageNum();2var annots = this.getAnnots(page);3for (var i = 0; i < annots.length; i++) {4var annot = annots[i];5if (annot.type == "Text") {6var text = annot.getText();7console.println(text);8}9}

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidget = new TextWidgetAnnotation();2textWidget.setText("Hello World");3textWidget.setFontSize(12);4textWidget.setFontColor(0, 0, 1);5textWidget.setFont("Helvetica");6textWidget.setPos(100, 100);7textWidget.draw();81. Fork it (

Full Screen

Using AI Code Generation

copy

Full Screen

1var textWidget = new TextWidgetAnnotation();2textWidget.page = this.pageNum;3textWidget.rect = [this.pageNum.width/2, this.pageNum.height/2, 100, 100];4textWidget.color = color.red;5textWidget.opacity = 0.5;6textWidget.value = "This is a text widget annotation";7textWidget.drawOnPage(this.pageNum);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful