JPanel to be set to A4 size

I'm creating a text editor in Java that will have output to PDF. In order to sync data that appears in my program and the output PDF as close as I can, I'd have to have a JPanel which has the same size as an A4 paper (or at least to be in scale). I have tried converting its mm dimension (297x210) to pixels, but opening a regular size A4 document in PDF results in a bigger page than my JPanel.

Would certain size in pixels match the size of every document (.doc,.pdf,etc) created in A4 size (displaying it at 100%), or are there variations from program to program?

I'm trying to make sense of the whole conversion deal... Do I have to visually match the size in the Adobe reader, or is there some kind of factor that you multply with page size in inches or milimeters? Is there anyone who knows how does the whole page size format deal works?


In my experience, there is no such thing as a printer standard. The behavior of printers or software like Adobe Acrobat Reader vary dramatically. Some might automatically shrink your A4-sized panel to fit in a single page with margins while others might print off 4 pages with a single pixel column on page two and a single pixel row on page 3.

Unfortunately you must go about it by trial and error. Make it work for Acrobat Reader and then try printing it out and seeing if it comes out the same. It helps to provide any and all hints as to how to format the page. Lacking these hints, much of this software tends to guess about what your intentions are.

Need Your Help

char to int conversion

java char int

So I have something like this:

Hibernate 4.3, when building SessionFactory why do we have to supply the properties twice?

java hibernate properties configuration hibernate-4.x

Using the Hibernate 4.3.5 when you want to create a SessionFactory (e.g. unit testing) you will have to supply the properties twice:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.