How to use StrikeOutAnnotation method in wpt

Best JavaScript code snippet using wpt

strikeout-annotation.ts

Source:strikeout-annotation.ts Github

copy

Full Screen

1import { Vec2 } from "mathador";2import { annotationTypes, lineCapStyles, lineJoinStyles } from "../../../../spec-constants";3import { CryptInfo } from "../../../../encryption/interfaces";4import { ParserResult } from "../../../../data-parse/data-parser";5import { ParserInfo } from "../../../../data-parse/parser-info";6import { DateString } from "../../../strings/date-string";7import { LiteralString } from "../../../strings/literal-string";8import { BorderStyleDict } from "../../../appearance/border-style-dict";9import { GraphicsStateDict } from "../../../appearance/graphics-state-dict";10import { ResourceDict } from "../../../appearance/resource-dict";11import { XFormStream } from "../../../streams/x-form-stream";12import { TextMarkupAnnotation, TextMarkupAnnotationDto } from "./text-markup-annotation";13export class StrikeoutAnnotation extends TextMarkupAnnotation { 14 constructor() {15 super(annotationTypes.STRIKEOUT);16 }17 18 static createFromDto(dto: TextMarkupAnnotationDto): StrikeoutAnnotation {19 if (dto.annotationType !== "/Strikeout") {20 throw new Error("Invalid annotation type");21 }22 if (!dto?.quadPoints?.length || dto.quadPoints.length % 8) {23 // the coordinates array length must be a multiple of 824 return;25 }26 const bs = new BorderStyleDict();27 bs.W = dto.strokeWidth;28 if (dto.strokeDashGap) {29 bs.D = dto.strokeDashGap;30 }31 32 const annotation = new StrikeoutAnnotation();33 annotation.$name = dto.uuid;34 annotation.NM = LiteralString.fromString(dto.uuid);35 annotation.T = LiteralString.fromString(dto.author);36 annotation.M = DateString.fromDate(new Date(dto.dateModified));37 annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));38 annotation.Contents = dto.textContent 39 ? LiteralString.fromString(dto.textContent) 40 : null;41 42 if (dto.rect) {43 annotation.Rect = dto.rect;44 } else {45 const vectors: Vec2[] = [];46 for (let i = 0; i < dto.quadPoints.length; i += 2) {47 vectors.push(new Vec2(dto.quadPoints[i], dto.quadPoints[i + 1]));48 }49 const {min, max} = Vec2.minMax(...vectors);50 annotation.Rect = [min.x, min.y, max.x, max.y];51 }52 annotation.C = dto.color.slice(0, 3);53 annotation.CA = dto.color[3];54 annotation.BS = bs;55 annotation.QuadPoints = dto.quadPoints;56 57 annotation.generateApStream();58 annotation._added = true;59 return annotation.initProxy();60 }61 62 static async parseAsync(parseInfo: ParserInfo): Promise<ParserResult<StrikeoutAnnotation>> {63 if (!parseInfo) {64 throw new Error("Parsing information not passed");65 }66 try {67 const pdfObject = new StrikeoutAnnotation();68 await pdfObject.parsePropsAsync(parseInfo);69 return {70 value: pdfObject.initProxy(), 71 start: parseInfo.bounds.start, 72 end: parseInfo.bounds.end,73 };74 } catch (e) {75 console.log(e.message);76 return null;77 }78 } 79 80 override toArray(cryptInfo?: CryptInfo): Uint8Array {81 const superBytes = super.toArray(cryptInfo); 82 return superBytes;83 }84 85 override toDto(): TextMarkupAnnotationDto {86 const color = this.getColorRect();87 return {88 annotationType: "/Strikeout",89 uuid: this.$name,90 pageId: this.$pageId,91 dateCreated: this.CreationDate?.date.toISOString() || new Date().toISOString(),92 dateModified: this.M 93 ? this.M instanceof LiteralString94 ? this.M.literal95 : this.M.date.toISOString()96 : new Date().toISOString(),97 author: this.T?.literal,98 textContent: this.Contents?.literal,99 rect: this.Rect,100 bbox: this.apStream?.BBox,101 matrix: this.apStream?.Matrix,102 quadPoints: this.QuadPoints,103 color,104 strokeWidth: this.BS?.W ?? this.Border?.width ?? 1,105 strokeDashGap: this.BS?.D ?? [3, 0],106 };107 }108 109 /**110 * fill public properties from data using info/parser if available111 */112 protected override async parsePropsAsync(parseInfo: ParserInfo) {113 await super.parsePropsAsync(parseInfo);114 // const {parser, bounds} = parseInfo;115 // const start = bounds.contentStart || bounds.start;116 // const end = bounds.contentEnd || bounds.end; 117 118 // let i = parser.skipToNextName(start, end - 1);119 // let name: string;120 // let parseResult: ParseResult<string>;121 // while (true) {122 // parseResult = parser.parseNameAt(i);123 // if (parseResult) {124 // i = parseResult.end + 1;125 // name = parseResult.value;126 // switch (name) {127 // default:128 // // skip to next name129 // i = parser.skipToNextName(i, end - 1);130 // break;131 // }132 // } else {133 // break;134 // }135 // };136 }137 138 protected generateApStream() {139 if (!this.QuadPoints?.length || this.QuadPoints.length % 8) {140 return;141 }142 const apStream = new XFormStream();143 apStream.Filter = "/FlateDecode";144 apStream.LastModified = DateString.fromDate(new Date());145 apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];146 // set stroke style options147 const opacity = this.CA || 1;148 const strokeWidth = this.strokeWidth;149 const strokeDash = this.BS?.D[0] ?? this.Border?.dash ?? 3;150 const strokeGap = this.BS?.D[1] ?? this.Border?.gap ?? 0;151 const gs = new GraphicsStateDict();152 gs.AIS = true;153 gs.BM = "/Normal";154 gs.CA = opacity;155 gs.ca = opacity;156 gs.LW = strokeWidth;157 gs.LC = lineCapStyles.SQUARE;158 gs.LJ = lineJoinStyles.MITER;159 gs.D = [[strokeDash, strokeGap], 0];160 // get color161 const colorString = this.getColorString();162 163 // push the graphics state onto the stack164 let streamTextData = `q ${colorString} /GS0 gs`;165 // fill stream data166 const bottomLeft = new Vec2();167 const bottomRight = new Vec2();168 const topRight = new Vec2();169 const topLeft = new Vec2(); 170 const start = new Vec2();171 const end = new Vec2();172 const q = this.QuadPoints;173 for (let i = 0; i < q.length; i += 8) {174 bottomLeft.set(q[i + 4], q[i + 5]);175 bottomRight.set(q[i + 6], q[i + 7]);176 topRight.set(q[i + 2], q[i + 3]);177 topLeft.set(q[i + 0], q[i + 1]);178 start.setFromVec2(bottomLeft).add(topLeft).multiplyByScalar(0.5);179 end.setFromVec2(bottomRight).add(topRight).multiplyByScalar(0.5);180 streamTextData += `\n${start.x} ${start.y} m`;181 streamTextData += `\n${end.x} ${end.y} l`;182 streamTextData += "\nS";183 }184 // pop the graphics state back from the stack185 streamTextData += "\nQ";186 apStream.Resources = new ResourceDict();187 apStream.Resources.setGraphicsState("/GS0", gs);188 apStream.setTextStreamData(streamTextData); 189 this.apStream = apStream;190 }191 protected override initProxy(): StrikeoutAnnotation {192 return <StrikeoutAnnotation>super.initProxy();193 }194 protected override getProxy(): StrikeoutAnnotation {195 return <StrikeoutAnnotation>super.getProxy();196 } ...

Full Screen

Full Screen

strikeOutAnnotationResponse.ts

Source:strikeOutAnnotationResponse.ts Github

copy

Full Screen

1 /**2 *3 * Copyright (c) 2022 Aspose.PDF Cloud4 * Permission is hereby granted, free of charge, to any person obtaining a copy5 * of this software and associated documentation files (the "Software"), to deal6 * in the Software without restriction, including without limitation the rights7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell8 * copies of the Software, and to permit persons to whom the Software is9 * furnished to do so, subject to the following conditions:10 * The above copyright notice and this permission notice shall be included in all11 * copies or substantial portions of the Software.12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE18 * SOFTWARE.19 *20 */21import { StrikeOutAnnotation } from "./strikeOutAnnotation";22import { AsposeResponse } from "./asposeResponse";23/**24* Represents response containing single strikeout annotation object25*/26export class StrikeOutAnnotationResponse extends AsposeResponse {27 /**28 * Strikeout annotation object29 */30 'annotation': StrikeOutAnnotation;31 static discriminator = undefined;32 static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [33 {34 "name": "annotation",35 "baseName": "Annotation",36 "type": "StrikeOutAnnotation"37 } ];38 static getAttributeTypeMap() {39 return super.getAttributeTypeMap().concat(StrikeOutAnnotationResponse.attributeTypeMap);40 }...

Full Screen

Full Screen

strikeOutAnnotations.ts

Source:strikeOutAnnotations.ts Github

copy

Full Screen

1 /**2 *3 * Copyright (c) 2022 Aspose.PDF Cloud4 * Permission is hereby granted, free of charge, to any person obtaining a copy5 * of this software and associated documentation files (the "Software"), to deal6 * in the Software without restriction, including without limitation the rights7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell8 * copies of the Software, and to permit persons to whom the Software is9 * furnished to do so, subject to the following conditions:10 * The above copyright notice and this permission notice shall be included in all11 * copies or substantial portions of the Software.12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE18 * SOFTWARE.19 *20 */21import { StrikeOutAnnotation } from "./strikeOutAnnotation";22import { LinkElement } from "./linkElement";23/**24* Object representing a list of strikeout annotations.25*/26export class StrikeOutAnnotations extends LinkElement {27 /**28 * List of strikeout annotations.29 */30 'list': Array<StrikeOutAnnotation>;31 static discriminator = undefined;32 static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [33 {34 "name": "list",35 "baseName": "List",36 "type": "Array<StrikeOutAnnotation>"37 } ];38 static getAttributeTypeMap() {39 return super.getAttributeTypeMap().concat(StrikeOutAnnotations.attributeTypeMap);40 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = require('webpage').create();2 var rect = page.evaluate(function() {3 var rect = document.querySelector('#hplogo').getBoundingClientRect();4 return {5 };6 });7 page.clipRect = {8 };9 page.render('google.png');10 phantom.exit();11});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptb = require('wptb');2var path = require('path');3var fs = require('fs');4var pdfPath = path.join(__dirname, 'test.pdf');5var outputPath = path.join(__dirname, 'test.pdf');6var strikeOutAnnotation = new wptb.StrikeOutAnnotation();7strikeOutAnnotation.setRect(100, 100, 400, 400);8strikeOutAnnotation.setContents('Test StrikeOut Annotation');9strikeOutAnnotation.setColor(0, 0, 1);10strikeOutAnnotation.setInteriorColor(0, 0, 1);11strikeOutAnnotation.setOpacity(0.5);12strikeOutAnnotation.setAuthor('Author Name');13strikeOutAnnotation.setSubject('Subject Name');14strikeOutAnnotation.setTitle('Title Name');15strikeOutAnnotation.setCreationDate(new Date());16strikeOutAnnotation.setModifiedDate(new Date());17strikeOutAnnotation.setFlags(wptb.PDFAnnotationFlags.Hidden);18strikeOutAnnotation.setIntent(wptb.PDFAnnotationIntent.StrikeOut);19strikeOutAnnotation.setCaption(true);20strikeOutAnnotation.setPopup(new wptb.PopupAnnotation());21strikeOutAnnotation.setInvisible(true);22strikeOutAnnotation.setLocked(true);23strikeOutAnnotation.setPrinted(true);24strikeOutAnnotation.setReadOnly(true);25strikeOutAnnotation.setNoZoom(true);26strikeOutAnnotation.setNoRotate(true);27strikeOutAnnotation.setNoView(true);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var options = {3};4wpt.runTest(options, function(err, data) {5 if (err) return console.log(err);6 var testId = data.data.testId;7 var options = {8 };9 wpt.getTestResults(options, function(err, data) {10 if (err) return console.log(err);11 var pageData = data.data.median.firstView;12 var url = pageData.url;13 var options = {14 };15 wpt.getTestResults(options, function(err, data) {16 if (err) return console.log(err);17 var pageData = data.data.median.firstView;18 var url = pageData.url;19 var options = {20 };21 wpt.getTestResults(options, function(err, data) {22 if (err) return console.log(err);23 var pageData = data.data.median.firstView;24 var url = pageData.url;25 var options = {26 };27 wpt.getTestResults(options, function(err, data) {28 if (err) return console.log(err);29 var pageData = data.data.median.firstView;30 var url = pageData.url;31 var options = {32 };33 wpt.getTestResults(options, function(err, data) {34 if (err) return console.log(err);35 var pageData = data.data.median.firstView;36 var url = pageData.url;37 var options = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = require('webpage').create();2var fs = require('fs');3 page.evaluate(function() {4 var strikeout = new StrikeOutAnnotation();5 strikeout.setPage(1);6 strikeout.setRect(100, 100, 200, 200);7 strikeout.setColor(255, 0, 0, 0);8 strikeout.setOpacity(0.5);9 strikeout.setContents("This is a strikeout annotation");10 strikeout.setAuthor("John Doe");11 strikeout.setSubject("Strikeout");12 strikeout.setModified("D:20170101000000Z");13 strikeout.setFlags(AnnotationFlag.Print | AnnotationFlag.Hidden);14 strikeout.setIcon(AnnotationIcon.Help);15 strikeout.setIntent("Strikeout");16 strikeout.setPopupIsOpen(true);17 strikeout.setPopupRect(100, 100, 200, 200);18 strikeout.setCreationDate("D:20170101000000Z");19 strikeout.setTitle("Strikeout");20 strikeout.setOpen(true);21 strikeout.setInvisible(true);22 strikeout.setLocked(true);23 strikeout.setPrinted(true);24 strikeout.setNoZoom(true);25 strikeout.setNoRotate(true);26 strikeout.setNoView(true);27 strikeout.setReadOnly(true);28 strikeout.setLockedContents(true);29 var strikeout2 = new StrikeOutAnnotation();30 strikeout2.setPage(1);31 strikeout2.setRect(100, 100, 200, 200);32 strikeout2.setColor(255, 0, 0, 0);33 strikeout2.setOpacity(0.5);34 strikeout2.setContents("This is a strikeout annotation");35 strikeout2.setAuthor("John Doe");36 strikeout2.setSubject("Strikeout");37 strikeout2.setModified("D:20170101000000Z");38 strikeout2.setFlags(AnnotationFlag.Print | AnnotationFlag.Hidden);39 strikeout2.setIcon(AnnotationIcon.Help);40 strikeout2.setIntent("Strikeout");41 strikeout2.setPopupIsOpen(true);42 strikeout2.setPopupRect(100, 100, 200, 200

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = require('webpage').create();2 page.evaluate(function() {3 var text = document.getElementById("lst-ib");4 var textRect = text.getBoundingClientRect();5 window.callPhantom({6 });7 });8 page.render("google.png");9 phantom.exit();10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var document = app.activeDocument;2var page = document.pages[0];3var textFrame = page.textFrames[0];4var textFrameBounds = textFrame.geometricBounds;5var strikeOutAnnotation = textFrame.parentStory.strikeOutAnnotation;6strikeOutAnnotation.startStrikeOut(textFrame, 0);7strikeOutAnnotation.endStrikeOut(textFrame, textFrame.characters.length-1);8strikeOutAnnotation.applyStrikeOut();

Full Screen

Using AI Code Generation

copy

Full Screen

1var document = app.activeDocument;2var page = document.pages[0];3var textFrame = page.textFrames[0];4var textFrameBounds = textFrame.geometricBounds;5var strikeOutAnnotation = textFrame.parentStory.strikeOutAnnotation;6strikeOutAnnotation.startStrikeOut(textFrame, 0);7strikeOutAnnotation.endStrikeOut(textFrame, textFrame.characters.length-1);8strikeOutAnnotation.applyStrikeOut();

Full Screen

Using AI Code Generation

copy

Full Screen

1var document = app.activeDocument;2var page = document.pages[0];3var textFrame = page.textFrames[0];4var textFrameBounds = textFrame.geometricBounds;5var strikeOutAnnotation = textFrame.parentStory.strikeOutAnnotation;6strikeOutAnnotation.startStrikeOut(textFrame, 0);7strikeOutAnnotation.endStrikeOut(textFrame, textFrame.characters.length-1);8strikeOutAnnotation.applyStrikeOut();

Full Screen

Using AI Code Generation

copy

Full Screen

1var document = app.activeDocument;2var page = document.pages[0];3var textFrame = page.textFrames[0];4var textFrameBounds = textFrame.geometricBounds;5var strikeOutAnnotation = textFrame.parentStory.strikeOutAnnotation;6strikeOutAnnotation.startStrikeOut(textFrame, 0);7strikeOutAnnotation.endStrikeOut(textFrame, textFrame.characters.length-1);8strikeOutAnnotation.applyStrikeOut();

Full Screen

Using AI Code Generation

copy

Full Screen

1var document = app.activeDocument;2var page = document.pages[0];3var textFrame = page.textFrames[0];4var textFrameBounds = textFrame.geometricBounds;5var strikeOutAnnotation = textFrame.parentStory.strikeOutAnnotation;6strikeOutAnnotation.startStrikeOut(textFrame, 0);

Full Screen

Using AI Code Generation

copy

Full Screen

1var textAnnot = new StrikeOutAnnotation();2textAnnot.SetContents("This is a strikeout annotation");3textAnnot.SetColor(0, 0, 255, 3);4textAnnot.SetQuaddingFormat(1);5textAnnot.SetDate(new Date());6textAnnot.SetRect(100, 100, 200, 200);7textAnnot.SetPageNumber(0);8textAnnot.SetFlags(4);9textAnnot.SetIntent("StrikeOut");10textAnnot.SetIconName("Comment");11textAnnot.SetOpen(true);12textAnnot.SetStateModel("Marked");13textAnnot.SetState("Accepted");14textAnnot.SetTitle("Title");15textAnnot.SetSubject("Subject");16textAnnot.SetCreationDate(new Date());17textAnnot.SetModifiedDate(new Date());18textAnnot.SetAuthor("Author");19textAnnot.SetContents("Contents");20textAnnot.SetPopupText("Popup Text");21textAnnot.SetPopupRect(150, 150, 250, 250);22textAnnot.SetPopupOpen(true);23textAnnot.SetInReplyTo("In Reply To");24textAnnot.SetRT("RT");25textAnnot.SetState("Accepted");

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptext = require('./wptext.js');2var fs = require('fs');3var pdf = new wptext.PDFDocument();4var page = pdf.addPage();5page.addStrikeOutAnnotation(50, 50, 100, 100);6pdf.save("test.pdf");

Full Screen

Using AI Code Generation

copy

Full Screen

1var pdfDoc = require('pdfkit');2var fs = require('fs');3var wptext = require('./wptext');4var doc = new pdfDoc;5var text = "This is a test of the StrikeOutAnnotation method of wptext.js";6var word = "test";7var strikeout = wptext.StrikeOutAnnotation(text,word);8doc.pipe(fs.createWriteStream('test.pdf'));9doc.addPage();10doc.fontSize(25);11doc.text(text);12doc.addPage();13doc.fontSize(25);14doc.text(strikeout);15doc.end();16### TextHighlightAnnotation(text,word)17var pdfDoc = require('pdfkit');18var fs = require('fs');19var wptext = require('./wptext');20var doc = new pdfDoc;21var text = "This is a test of the TextHighlightAnnotation method of wptext.js";22var word = "test";23var highlight = wptext.TextHighlightAnnotation(text,word);24doc.pipe(fs.createWriteStream('test.pdf'));25doc.addPage();26doc.fontSize(25);27doc.text(text);28doc.addPage();29doc.fontSize(25);30doc.text(highlight);31doc.end();32### TextUnderlineAnnotation(text,word)33var pdfDoc = require('pdfkit');34var fs = require('fs');35var wptext = require('./wptext');36var doc = new pdfDoc;37var text = "This is a test of the TextUnderlineAnnotation method of wptext.js";38var word = "test";39var underline = wptext.TextUnderlineAnnotation(text,word);40doc.pipe(fs.createWriteStream('test.pdf'));41doc.addPage();42doc.fontSize(25);43doc.text(text);44doc.addPage();45doc.fontSize(25);46doc.text(underline);47doc.end();48### TextSquigglyAnnotation(text,word)

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