Java Swing - PDF Thumbnail Viewer - java

I'm kinda new in programming and I'm trying to learn everything by myself.
Currently I'm working on a project to sort all my bills and other stuff.
I managed it to updload the bills as PDF files onto a FTP Server.
I'm displaying all outgoing money in a JTable and now I'd like to see a Thumbnail of the PDF
in the right part of my swing GUI after i selected a table row.
Here is what I was thinking of:
Get the selected row via a clickListener, read the bill number, which is the same number the file is called on the FTP (e.g. Number: "20130012" / File: "20130012.pdf").
Download the file from the FTP and save it somewhere temporary?!
and now I need to display the pdf in my grid layout but how =) ? If
it is a picture I could use the Image Icon right? But how do I get
the effect with a pdf?
As soon as I click on the thumbnail, I'd like to open up a pdf reader to see the actual file.
Sorry if this is to less information... just let me know if you need further information.
I'd really appreciate a few answers =)
Thanks

Use a ListSelectionListener to determine which JTable row was clicked and fetch its PDF file. If fetch latency is a problem, use SwingWorker. Once you create a thumbnail image of each page in the selected row's PDF, you can display them in a JList as shown here. Display the selected page at full size in your implementation of ListSelectionListener.

Related

Render a table to an image file in Java

I have data in a table of an arbitrary size that I would like to render as an image file. What is the best way to go about this in Java? I can't seem to find any libraries written explicitly for rendering tables.
Example:
I might have three columns ("Col1", "Col2", "Col3") and three rows of data. I would expect output as an image file like this (formatting doesn't need to match exactly):
Possible solutions/workarounds I've considered:
Using some sort of pdf library to assemble a table and then converting the pdf to an image. I tried itext7, but couldn't manage to render a pdf with a table as an image.
Using a Swing JTable instance in an invisible JFrame and creating an image from that. The problem with this solution is that I need this code to work in a headless Ubuntu server environment, and it just throws a HeadlessException.
Rendering a LaTeX table with some library, though a quick Google search came up empty for such libraries that can create tables.
You can technically render this data in table and generate a PDF and later export it as an image(JPEG/PNG/TIFF,BMP) using pdfRender product of iText 7.
Please refer to this page of iText https://itextpdf.com/en/products/itext-7/convert-pdf-to-image-pdfrender

How to generate custom PDF documents with text and images from user input Android

In my project I want users to be able to create custom documents with text and images with the document then being saved to PDF format.
I would like that document to be generated as blank at first and then the user can insert text boxes and images from a gallery, both of which can be moved, resized, or deleted. I would also like a function to add new pages, with undo and redo last action buttons.
Is this possible in Android Studio? I've watched some tutorials and they use EditText for text input but these are not user-generated, or moveable. Same goes for image insertion.
Does anybody have any documentation on creating custom documents of this nature? I am coding in Java.
Thanks.

How to Merge a background Image and the HTML Content as one downloadable Image

Thanks in Advance. I am working on JSP Platform and I have a requirement wherein I need to provide a membership card which will have an image as the Background with all the details like name, telephone number, Membership ID and other personal details. All these details will be captured in a form and then displayed over the card image with the details.
But when the html form is submitted the data is saved in MYSQL and the JSP page displays the Card with the details on its desired position. What I am looking at is that is there a way to make that card image along with the details appear as an image which the user can directly download coz now if the user is trying to download he just gets the Blank background image without any data. Is there a way to merge the card image and the data as a single image or something which can easily be downloaded and also sent as an image to the users email.
You want something like a screenshot, right?
Here a tool to convert HTML source to pdf:
http://wkhtmltopdf.org/
This post can also help:
Convert web page to image

HTML gallery page in Swing with drag-drop functionality

I was asked to write a JDialog separated into left and right panel. The left panel shows a demo HTML template gallery (small sized), and right panel shows series or list of images. I want to make it such that I can drag image on the list and place it on the gallery (or maybe drag out some image from the gallery). The problem is I don't know where to start with this, can anybody give me some idea?
An HTML gallery typically uses JS to do the 'heavy lifting' (I'm guessing it will require a slideshow as well). While Swing components support HTML (to an extent) they do not support JS.
I recommend not trying to render the HTML/JS in the GUI, instead, provide a JList in the GUI of the image+name objects chosen by the user (using JFileChooser). When each image is selected, you can show the 'preferred name' in a JTextField that allows the user to edit it.
Image order can be shown by the order in the list. To change the order, implement Drag'n'Drop. See the Drag and Drop and Data Transfer lesson for more details.
You will probably need a JLabel in the CENTER of the GUI to display the (full size) selected image, and show the order & timing of the slideshow.
Once the user is happy with the image selections, the order, the names & timing. Offer them a button to write all the details to a single directory including the HTML, script & images (easier). Once the HTML is written, invoke Desktop.open(File) to display the finished product to the user.
As to how you do all that, it is really beyond the scope of an answer on SO. You would need to do the tutorial on each part, and come back with more specific questions.

adding image into existing pdf

i just want add image into existing pdf that i tried, but it replace the code that i dont want.I just want to insert image at perticular location with previous data.and image should not replace that data.
iText http://itextpdf.com/ lets you do this kind of things

Categories

Resources