This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sourceB = from('a'); | |
| sourceB.subscribe(console.log); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let eventSource = fromEvent(document, 'mousemove', {passive: true}); | |
| eventSource.subscribe(val => console.log(val as MouseEvent)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const successPromise = new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve('success'); | |
| }, 2000); | |
| }); | |
| const aSourceB = from(successPromise); | |
| aSourceB.subscribe(console.log); | |
| console.log('wait for success promise'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var observableClickDown$ = fromEvent(document, 'mousedown', { passive: false }); | |
| var observableMove$ = fromEvent(document, 'mousemove', { passive: false }); | |
| var observableClickUp$ = fromEvent(document, 'mouseup', { passive: false }); | |
| var chained$ = observableClickDown$.pipe( | |
| switchMap((val: MouseEvent) => | |
| observableMove$.pipe( | |
| takeUntil(observableClickUp$), | |
| timeout(2500), | |
| catchError(error => of('Timed out')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var promise1 = new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve(1) | |
| }, 5000); | |
| }); | |
| var promise2 = new Promise((resolve, reject) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private BridgeContext ctx; | |
| private GVTBuilder builder; | |
| UserAgent userAgent = new UserAgentAdapter(); | |
| DocumentLoader loader = new DocumentLoader(userAgent); | |
| ctx = new BridgeContext(userAgent, loader); | |
| ctx.setDynamicState(BridgeContext.DYNAMIC); | |
| builder = new GVTBuilder(); | |
| GraphicsNode mapGraphics = builder.build(ctx, svgDocument); | |
| mapGraphics.paint(g2d); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected CustomSVGDocumentFactory factory; | |
| String parser = XMLResourceDescriptor.getXMLParserClassName(); | |
| factory = new CustomSVGDocumentFactory(parser); | |
| SVGDocument svgDocument = factory.createSVGDocument(new ByteArrayInputStream(decodedSvg)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); | |
| Document document = new Document(new Rectangle(width, height)); | |
| PdfWriter writer = PdfWriter.getInstance(document, arrayOutputStream); | |
| document.open(); | |
| PdfContentByte cb = writer.getDirectContent(); | |
| PdfTemplate map = cb.createTemplate(width, height); | |
| Graphics2D g2d = new PdfGraphics2D(map, width, height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>com.itextpdf</groupId> | |
| <artifactId>itextpdf</artifactId> | |
| <version>5.5.13</version> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Dimension pageSize = ppt.getPageSize(); | |
| shape.setAnchor(new java.awt.Rectangle(5, 80, pageSize.width - 10, model.height – model.height); | |
| ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | |
| ppt.write(outputStream); | |
| ppt.close(); | |
| return new ByteArrayInputStream(outputStream.toByteArray()); |