Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT How to convert a swing form to PDF

Have Programming Question? Ask it here!
 
 
 


Vishal Nayakwadi
How to convert a swing form to PDF
2 Answer(s)      2 years and 9 months ago
Posted in : Swing AWT


Sir, I want to know about how convert a swing form containing textbox,JTable,JPanel,JLabel, Seperator etc swing menus to a PDF file using java code


Advertisement
View Answers

August 3, 2012 at 12:55 PM


import com.stevesoft.phreida.*; import java.awt.*; import java.io.*;

public class Test1 { public static void main(String[] args) throws Exception { // Create the PGraphics object PGraphics pg = new PGraphics("test1.pdf");

// Draw something -- some text with a box around it.
Font f = new Font("Helvetica",Font.PLAIN,25);
pg.setFont(f);
FontMetrics fm = pg.getFontMetrics(f);
int border = 1;
int d = fm.getDescent();
int h = fm.getHeight();
int w = fm.getLeading();
String str = "Hello, world";
int y = (10+fm.getAscent());
pg.drawString(str,10,y);
pg.drawRect(10-border,10-border+d,
            fm.stringWidth(str)+w+2*border,
             h+2*border);

// Finish
pg.dispose(); // writes out file
System.exit(0); // Graphics thread is running still

} }



August 3, 2012 at 12:57 PM


for above reqiuerd download jar file stevesoft phreida



Related Tutorials/Questions & Answers:
How to convert a swing form to PDF
How to convert a swing form to PDF  Sir, I want to know about how convert a swing form containing textbox,JTable,JPanel,JLabel, Seperator etc swing menus to a PDF file using java code
How to Convert PDF into rtf File Java
How to Convert PDF into rtf File Java  Hi, How could in covert the PDF file to rtf file in Java Programming. Please suggest any online example... the online example of Java Convert PDF into rtf File. Thanks
Advertisements
convert excel into pdf
convert excel into pdf  How to convert excel into pdf files
convert an pdf file to html in Java
convert an pdf file to html in Java  Hi all, How to convert an pdf file to html in Java? Currently all my data is generated into a report in pdf and i want to be able to generate it to html page as well. How to go about
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
convert word document to pdf
convert word document to pdf  Hi, Could you please help me write a java code that converts the word docuemnt into PDF? I have to save the generated..."); f.convert(fos,"pdf"); I would also want to know, what does "OfficeFile" in the code
CONVERT JTable DATA TO PDF FILE
CONVERT JTable DATA TO PDF FILE  HOW TO CONVERT JTable DATA TO .PDF... the jtable data from the jframe and stored the data into the pdf file in the form...); button=new JButton("Save to pdf"); button.addActionListener(new ActionListener
Convert Text File to PDF file
Convert Text File to PDF file  Here is the way how to covert your Text file to PDF File, public class TextFileToPDF { private static void...(inLine); System.out.println("Text is inserted into pdf file
how to convert doc file into html using java swing
how to convert doc file into html using java swing  i want to convert doc file into html and display it on jtextarea please help me and give the sample code
Convert pdf to rtf and txt - XML
Convert pdf to rtf and txt  Can we convert PDF to RTF and TXT, and how?  Hi Friend, Try the following codes: 1)Convert PDF to RTF...) {} } } 2)Convert PDF to TEXT import java.io.*; import java.util.
Java convert jtable data to pdf file
Java convert jtable data to pdf file In this tutorial, you will learn how to convert jtable data to pdf file. Here is an example where we have created... have fetched the data from the jtable and save the data to pdf file. Example
Convert PDF to XML in Java
Convert PDF to XML File in Java In this Java tutorial section, you will learn how to convert pdf file to xml using java program. We have used itext api for this purpose. To read hello.pdf file, we have used PDFReader class. The data
Convert Text File to PDF file
Convert Text File to PDF file  import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.FileReader; import...); System.out.println("Text is inserted into pdf file"); document.close
convert data from pdf to text file - Java Beginners
convert data from pdf to text file   how to read the data from pdf file and put it into text file(.txt
how to load pdf on html
how to load pdf on html  how to load pdf on html
to convert html to pdf in java - Java Beginners
to convert html to pdf in java  HI all, i want to convert html to pdf using java. actually i dont need as the tags in the html. but the tags should be removed and i need only the text in that. Thanks in advance
Convert pdf to rtf file using Java
Convert pdf to rtf file using Java In this section, you will learn how to convert .pdf file to .rtf file in java programming language. We have used itext api for this purpose. To read resume.pdf  file, we have used PDFReader class
convert this html form to jsp
convert this html form to jsp  <html> <head> <script language="javascript" src="images/validationm.js"></script> <...;/tr> <form name="VillageDetailsForm" action="AddVillage.jsp" method
Convert pdf to text file using Java
How to Convert pdf to text file in Java In this section, you will learn how to convert pdf file to text file in Java Programming. We have used itext api for this purpose. To read resume.pdf  file, we have used PDFReader class
To convert Html to pdf in java - Java Beginners
To convert Html to pdf in java  Hi all, I want to convert html file to pdf file using java. can any one help me out. Thanks & Regards Santhosh Ejanthkar  Hi Friend, Try the following code: import
form field mapping with pdf file using java
form field mapping with pdf file using java   Hai all, I have one requirement that i have one html form.i have to map the form fields with pdf... related to the field in pdf file should marked with a color. can any one give
How to create form in Swings
How to create form in Swings  How to create registration, login and question form in Java Swing?   Creating different forms in Java Swing - Examples how to create registration form in swing swing login form example
how to generate pdf file in struts
how to generate pdf file in struts  I am developing a struts application.I am having one registration form when i am submitting the form the values are stored in database,the database name is registration. In another form i am
how to generate pdf file in struts
how to generate pdf file in struts  I am developing a struts application.I am having one registration form when i am submitting the form the values are stored in database,the database name is registration. In another form i am
put image on form creating in swing-swing code - Swing AWT
put image on form creating in swing-swing code  i want to display image on swing panel and get the image co ordinate by mouse clicking.and also zoom the image at particular area of image. please give solution on my email id
how to print pdf format
how to print pdf format  Hi every body iam doing school project iam using backend as oracle front end java .how to print student marks list /attendence in pdf format. please help me. thanks in advance.   Here
convert jpeg to gif - Swing AWT
convert jpeg to gif  i want to convert jpeg file to gif file. in the roseindia's already existing program,i can convert gif to jpeg.But i cant convert jpeg to gif. help me plz....  Hi friend, import java.io.
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
how to dispaly pdf file on browser
how to dispaly pdf file on browser  In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by tag can anyone give me
How to convert a String to an int?
How to convert a String to an int?  I my program I am taking the input from user from a HTML form in JSP page. The value retrieved is in the String format. Now I want to convert into int value. Tell me How to convert a String
How to convert into to String in Java?
How to convert into to String in Java?  Hi, How to convert into to String in Java? Thanks
how to display pdf file on browser
how to display pdf file on browser   In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by iframe tag can anyone
Display Logo on login form using swing
Display Logo on login form using swing In this tutorial, you will learn how to display a logo in login form using swing components. Here is an example where... a logo for this login form, we have used ImageIcon class that accepts the image
SWT login form - Swing AWT
SWT login form  Hi, I want code to create a login form in SWT. My...(2, false)); shell.setText("Login form"); label1=new Label(shell...|SWT.CANCEL); messageBox.setText("Login Form"); messageBox.setMessage
How to Make a Pdf and inserting data
How to Make a Pdf and inserting data       In this tutorial you will learn how we can make a pdf file and how we can insert a data into the pdf file. This all
How to read PDF files created from Java thru VB Script
How to read PDF files created from Java thru VB Script  We have created the PDF file thru APache FOP but when we are unable to read the data thru... to read the FOP pdf? Is their any tool which convert the Apache FOP to Adobe PDF
How to convert NSString to NSInteger?
How to convert NSString to NSInteger?  Hi, Provide me code to convert NSString into NSInteger. Thanks   Hi, Use the following code example: NSString * s= @"100"; NSInteger i = [s intValue]; Thanks
how to convert ACSII to HEX
how to convert ACSII to HEX  How to convert perticular ASCII... value of ~:00   The given code accepts the string and convert...() to convert it to Hex value. class ConvertAsciiToHex { public static void
How to Convert String to Date?
How to Convert String to Date?  Hi, I am new in Java and learning... have to convert it to Date object. Tell me How to Convert String to Date? Thanks   Hi Dude, Its very easy to convert the String into date format
Convert ZIP To PDF
Convert ZIP To PDF       Lets discuss the conversion of a zipped file into pdf file... it and then store it into a byte array. Convert this array of byte into the string
Convert Text To PDF
Convert Text To PDF       Here we are discussing the convertion of a text file into a pdf file... into the add() method of the document class to generate a pdf file. Download iText API
how to convert jsp to exe
how to convert jsp to exe  hello sir, i am doing webapplication. the configuration is windows xp operating system,IE6.0,apache... to another system. so i want to convert this to exe. that will executed only internet
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
How to convert string to byte in Java
How to convert string to byte in Java  How to convert string to byte in Java
How to convert XML file to database ?
How to convert XML file to database ?  How to convert XML file to database
"Urgent" convert this code to GUI - Swing AWT
"Urgent" convert this code to GUI   please convert for me this code to GUI THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. //CLASS CashDispenser public class
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI  THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. // class ATM import javax.swing.*; import java.awt.*; public class ATM
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI    THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. // class ATM import javax.swing.*; import java.awt.*; public
 

 

 

DMCA.com