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
package com.puppeteer.pdf.serivce; | |
import jakarta.servlet.http.HttpServletResponse; | |
import lombok.extern.log4j.Log4j2; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.core.io.Resource; | |
import org.springframework.stereotype.Service; | |
import org.thymeleaf.TemplateEngine; |
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
package com.puppeteer.pdf.controller; | |
import com.puppeteer.pdf.serivce.CreatePDFService; | |
import jakarta.servlet.http.HttpServletResponse; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.core.io.ByteArrayResource; | |
import org.springframework.http.HttpHeaders; | |
import org.springframework.http.HttpStatus; | |
import org.springframework.http.MediaType; |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | |
<title>Puppeteer PDF Generate In Springboot Application With NodeJs</title> | |
</head> | |
<body> |
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 puppeteer = require('puppeteer') | |
async function generatePDFFile() { | |
// Catch all input parameter received from API | |
const cmdArguments = process.argv.slice(2); | |
const htmlContent = cmdArguments[0]; | |
const pdfPath = cmdArguments[1]; | |
// Here we need OS name for change default browser Executable path for print the PDF | |
let browser = await puppeteer.launch({devtools: true,executablePath: 'C://Program Files//Google//Chrome//Application//chrome.exe'}); // Change path according to your Chrome installation location | |
const page =await browser.newPage(); |
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
{ | |
"name": "spring-pdf", | |
"version": "1", | |
"dependencies": { | |
"puppeteer": "^22.12.1" | |
} | |
} |
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
package com.alis.soft.socketIO.socketcontroller; | |
import com.alis.soft.socketIO.data.Message; | |
import com.corundumstudio.socketio.AckRequest; | |
import com.corundumstudio.socketio.SocketIOClient; | |
import com.corundumstudio.socketio.SocketIOServer; | |
import com.corundumstudio.socketio.listener.ConnectListener; | |
import com.corundumstudio.socketio.listener.DataListener; | |
import com.corundumstudio.socketio.listener.DisconnectListener; | |
import lombok.extern.log4j.Log4j2; |
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
package com.alis.soft.socketIO.config; | |
import javax.annotation.PreDestroy; | |
import io.netty.bootstrap.ServerBootstrap; | |
import io.netty.channel.ChannelInitializer; | |
import io.netty.channel.EventLoopGroup; | |
import io.netty.channel.nio.NioEventLoopGroup; | |
import io.netty.channel.socket.SocketChannel; | |
import io.netty.channel.socket.nio.NioServerSocketChannel; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>2.7.4</version> | |
<relativePath/> <!-- lookup parent from repository --> | |
</parent> |
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
package com.practical.multi.thread; | |
import java.util.LinkedList; | |
public class ConsumerProducerProblemSolution { | |
public static void main(String ...args) { | |
//Class which contain consumer method and producer | |
ProducerAndConsumer producerAndConsumer=new ProducerAndConsumer(); | |
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
package pckMain; | |
public class ThreadExampleWithRunnableNormal { | |
public static void main(String[] args) { | |
Thread threadOne = new Thread(new MainThreadClass(), "Thread One"); | |
Thread threadTwo = new Thread(new MainThreadClass(), "Thread Two"); | |
Thread threadThree = new Thread(new MainThreadClass(), "Thread Three"); |
NewerOlder