Displaying pdf file from database

I want to save and display images and pdf files into the database instead of FileDescriptor.
Saving image (jpeg, png…) and pdf files into the database are working fine. Displaying image file works also ok but pdf.

I used the following piece of code to display files when it is saved as FileDescriptor:

 //Display the file when selected in the dataGrid
        salesOrderAttachmentTable.addSelectionListener(e -> {
            if(e.getSelected()!=null){
                ExtFileDescriptor fd = (ExtFileDescriptor) salesOrderAttachmentTable.getSingleSelected().getAttachment();
                if (fd != null) {
                    if (fd.getExtension().equalsIgnoreCase("pdf")) {

                        browserFrame.setSource(FileDescriptorResource.class).setFileDescriptor(fd)
                                .setMimeType("application/pdf");
                    } else {
                        browserFrame.setSource(FileDescriptorResource.class).setFileDescriptor(fd);
                    }
                }
            }
        });

I am using the following program to save my image or pdf files into database table as ByteArray:

 attachmentUpload.addFileUploadSucceedListener(fileUploadFinishEvent -> {

            try {
                if(attachmentUpload.getFileContent() !=null) {
                    EmployeeAttachment attachment = dataContext.create(EmployeeAttachment.class);
                    attachment.setFileImage(IOUtils.toByteArray(attachmentUpload.getFileContent()));
                    attachment.setDescription(attachmentUpload.getFileName());
                    attachment.setEmployee(getEditedEntity());
                    employeeAttachmentDc.getMutableItems().add(attachment);
                }
            } catch (IOException e) {
                notifications.create(Notifications.NotificationType.TRAY).withDescription("Image file upload error").show();
            }
        });

and following xml code to display saved image file:

 <groupBox id="fileImageBox" spacing="true" height="100%">
                                <image id="fileImageField" scaleMode="CONTAIN" height="100%" width="100%"
                                       dataContainer="employeeAttachmentDc" property="fileImage"/>
                                <browserFrame id="browserFramePdf" height="100%" width="100%"/>
                            </groupBox>

But if the file is pdf, it doesn;t display. I would appreciate it if someone shares the code snippet of displaying pdf file from the database (ByteArray).