modify code add library pypdf2 to show and work with pdf. code - import sys
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QVBoxLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QFileDialog
from PyQt5.QtCore import QSize, Qt, QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView




class TextInputWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def sizeHint(self):
        return QSize(800, 600)

    def initUI(self):
        self.text_label = QLabel('Enter the text to be saved:')
        self.text_input = QLineEdit(self)
        self.filename_label = QLabel('Enter the name of the file:')
        self.filename_input = QLineEdit(self)
        self.save_button = QPushButton('Save', self)
        self.save_button.clicked.connect(self.save_text)

        hbox1 = QHBoxLayout()
        hbox1.addWidget(self.text_label)
        hbox1.addWidget(self.text_input)
        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.filename_label)
        hbox2.addWidget(self.filename_input)
        hbox3 = QHBoxLayout()
        hbox3.addWidget(self.save_button)

        # Add drag and drop input
        self.drop_label = QLabel('Drag and drop a file here')
        self.drop_label.setAlignment(Qt.AlignCenter)
        self.drop_label.setAcceptDrops(True)
        self.drop_label.setStyleSheet('''
        border: 4px dashed #aaa;
        border-radius: 10px;
        font-size: 18px;
        padding: 10px;
        ''')
        self.drop_label.setMinimumSize(400, 200)
        self.drop_label.dragEnterEvent = self.dragEnterEvent
        self.drop_label.dropEvent = self.dropEvent

        # Add button to display filename
        self.show_file_button = QPushButton('Show File Name', self)
        self.show_file_button.clicked.connect(self.show_filename)
        
        
        # Add QWebEngineView to display PDF
        self.pdf_view = QWebEngineView(self)
        self.pdf_view.setMinimumSize(800, 600)
        
        # Add buttons to navigate through PDF pages
        self.prev_page_button = QPushButton('<', self)
        self.prev_page_button.clicked.connect(self.prev_page)
        self.next_page_button = QPushButton('>', self)
        self.next_page_button.clicked.connect(self.next_page)        
        

        vbox = QVBoxLayout()
        vbox.addLayout(hbox1)
        vbox.addLayout(hbox2)
        vbox.addLayout(hbox3)
        vbox.addWidget(self.drop_label)
        vbox.addWidget(self.show_file_button)
        vbox.addWidget(self.pdf_view)
        vbox.addWidget(self.prev_page_button)
        vbox.addWidget(self.next_page_button)        
        self.setLayout(vbox)
        
        #self.setMinimumSize(QSize(600, 200))

    def save_text(self):
        text = self.text_input.text()
        filename = self.filename_input.text()
        with open(filename, 'w') as f:
            f.write(text)
            QMessageBox.information(self, 'Success', f'Text saved successfully to {filename}')

    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls() and event.mimeData().urls()[0].toString().endswith('.pdf'):
            event.accept()
        else:
            event.ignore()

    def dropEvent(self, event):
        if event.mimeData().hasUrls() and event.mimeData().urls()[0].toString().endswith('.pdf'):
            url = event.mimeData().urls()[0]
            filename = url.toLocalFile()
            self.filename_input.setText(filename)
            self.pdf_view.load(QUrl.fromLocalFile(filename))

    def show_filename(self):
        filename = self.filename_input.text()
        QMessageBox.information(self, 'File Name', filename)

    def prev_page(self):
        QMessageBox.information(self, 'Success', f'prev successfully to')
        self.pdf_view.page().runJavaScript('window.history.back()')

    def next_page(self):
        QMessageBox.information(self, 'Success', f'next successfully to')
        self.pdf_view.page().runJavaScript('window.history.forward()')


if __name__ == "__main__":
    app = QApplication(sys.argv)
    input_widget = TextInputWidget()
    input_widget.show()
    sys.exit(app.exec_())