PDF FAQ
This is a list of frequently asked questions, divided in to sections.
If you have a question which is not answered here, please ask in the support forum and we will try to answer it.
General Questions
Licensing details
Running the software
Java related questions
Font related questions
Text Extraction related questions
Image related questions
Print related questions
PDF specific questions
General questions
Q. What does the product do?
Java PDF Extraction Decode Access Library is a Java library to provide Java PDF printing, full text searching of PDF files, PDF rasterizing and a fully-featured Java PDF viewer which can be integrated into your code or run as a standalone solution.
Q. How do I turn a PDF into images?
This all setup for you. Have a look at PDF thumbnails extraction tutorial
Q. Is it a client or server component?
Either - we designed it to be very flexible. It extends a JPanel and can be used with Swing, and we have examples of it as an applet, Swing Application, Flex application, Java Webstart. It can equally happily run as a PDF printing, PDF searching, PDF rendering or PDF extraction tool.
Q. How do I obtain the software ?
The software is available exclusively from IDRsolutions. It can be bought via our online shop or we can arrange a PO. A demo is available to download. We offer a 30 day money back option on all sales for complete peace of mind.
Q. How do I get started
There is a full set of tutorials and a comprehensive collection of example applications built into JPedal with full-source so you can start immediately and customise. If you need any help, you just need to ask on the support forums.
Q. What if I need additional features in JPedal?
JPedal is under active development with regular new features. We announce all new releases on our RSS feed.
We are also happy to quote on writing additional features or new example code.
Q. What about support?
Support is provided via email or support forums to all prospective and current customers. Please contact us if you have additional requirements.
Licensing details
Q. What license options are available?
JPedal is licensed with the full package under a Commercial license. We try to keep it as simple and transparent as possible so have two standard packages -
- a site license basis (for people who want to use it servers at a single location)
- OEM license for customers who wish to build it into their application
If neither fits your required usage, please contact us with details and we will try to provde an appropriate alternative.
Q. Is there an Open Source version?
There is also a cut down and more limited Viewer only version under the LGPL license - this allows you to use it with any software development (Open Source or commercial).
You can find more information about the LGPL license here. The LGPL version is unsupported except on a commercial basis.
Q. Can I use JPedal for educational purposes and non-commercial purposes without charge?
If you can use the LGPL license, you have access to the LGPL version. Otherwise, please contact us with your details.
Running the software
How do I tell which version of JPedal I am running?
When you run JPedal as a viewer, the version number (something like 4.38b44) will appear in the top title bar. You can also access if in your code from the variable org.jpedal.PdfDecoder.VERSION. You can always see the latest version number on the download page.
Q. Will it run as an applet or under webstart?
JPedal can be run as part of an application. It will also run using webstart or as a JApplet (if Java is set correctly for applets on the target machine). If running as an Applet, all jars must be signed
The demo version is setup to run as an Applet and under webstart from the JPedal site. Note the jpedal.jar is signed so may need to be modified is you are additionally signing jars.
Q. What platforms will it run on?
Because it is written in pure Java it can run on any Operating System where Java is available. It is developed and tested on Windows, OS X and Linux
Java related questions
Q. Why do I sometimes get out of memory error messages?
Image handling can consume lots of memory and the default upper limit for Java may not be adequate. You can increase this using the -xMx option when starting Java.
Q. Which version of Java does it support?
JPedal has been developed and runs on JRE 1.5 and higher.
Q. Is there any debug or logging functions?
Yes. If you startup Java with the option -Ddebug, information will be written to screen and to a log file.
You can also write logging to a file using this code
LogWriter.setupLogFile(true,1,"","v",false); //"v" provides screen output as well LogWriter.log_name = "/mnt/shared/log.txt"; //logging file
Q. What about creating PDFs in Java?
There is already a package called iText which does this very well. iText can be integrated into JPedal to provide extra functions such as forms saving.
Q. What libraries are required?
JPedal requires no other libraries to run but may need some libraries to support certain PDF files and functions. Click here for details.
Q. I am running it under Unix/Linux and get X11 errors. What do I do?
Under Linux/Unix, an X11 server (ie a GUI) is assumed. If you run it as a console application, this will cause X11 errors.
Java has a special mode to allow for this called headless mode. When you start java, use the option -Djava.awt.headless=true
Q. PDF files contain lots of images. Are these cached?
In hires mode, images are stored on disk to reduce memory overheads in a temp directory. This can be altered in the jpedal.io.ObjectStore class by altering the setting of temp_dir
Q. Java on my machine crashes when I run JPedal. How do I fix this?
On some machines, Java2D's hardware acceleration may cause the machine to crash due to driver bugs. To get around this problem, add the following to the command line: -Dsun.java2d.noddraw=true.
Q. Can I change the language used?
JPedal makes use of the java Locale class, and as such can be run using different languages and local settings.
SimpleViewer can be run in a different language by setting the following flags in the command line:
-Duser.language=en -Duser.country=EN.
The first flag: -Duser.language=en sets the language that is used to display menu text and other string resources used in the program. The choice of language is a two letter lowercase code (in this example it is English). A list of standard codes for the language choice can be found here.
The second flag: -Duser.country=EN sets the locale that will be used. A locale is description of how to display numbers, decimals, currency and dates etc which is customised to suit the different requirements of different countries. The locale is a two letter Uppercase code (in this example EN is England). A list of standard codes for locales can be found here.
JPedal currently supports English, French and German. Without setting this flag manually, the program defaults to English.
If the Locale does not have a properties file, the program defaults to English with a message.
There is some sample code in SimpleViewer.
Font related questions
Q. Is there an easy way to tell if a PDF contains embedded fonts?
There is a method in PdfDecoder called PDFContainsEmbeddedFonts() which returns true or false. There is a short example showing how to use it called org.jpedal.examples.ShowIfEmbeddedFontsUsed which takes a file name as a parameter.
Q. Fonts seem quite complicated.
Unfortunately font options are complex in PDF files. We added several tutorials to help explain.
Q. Why do some fonts appear slightly different in the JPedal renderer compared with Acrobat?
If the font is not embedded, Java has to use the fonts it has available (which are not always the same as those visible to the user). If it cannot find a match it uses a font called Lucida Sans as a default so that it can display the page.
The SimpleViewer built-in application allows you to see font mappings by clicking on the Properties button. Fonts available will vary from platform to platform and this menu also lets you see available fonts.
There are tutorials on font handling, documented source code in SimpleViewer and ExtractPagesAsThumbnails examples. Font mappings for Windows, OS X and Linux are set in our versions to an general set.
If you are writing your own custom version, you should add a call to this method at the start
//mappings for non-embedded fonts to use
FontMappings.setFontReplacements();
You can also setup mappings manually with code like this.
/**
* font mappings
*/
//set specific cases for Windows
String[] aliases1={"helvetica","arial"};
decode_pdf.setSubstitutedFontAliases("arial",aliases1);
String[] aliases2={"Helvetica-Bold"};
decode_pdf.setSubstitutedFontAliases("Arial-BoldMT",aliases2);
String[] aliases3={"Times-Bold","Times-Roman"};
decode_pdf.setSubstitutedFontAliases("timesbd",aliases3);
//set general mappings for non-embedded fonts (assumes names the same)
PdfDecoder.setFontDirs(new String[]{"C:/windows/fonts/","C:/winNT/fonts/","/System/Library/Fonts/","/Library/Fonts/"});
Q. Can I change the font used to for the default to another font?
Yes. This code will allow you to select any Java font and provide a list if the option are not valid.
Q. Can I get JPedal to sustitute a non-embedded font with a font of my choice?
Yes. They can be included in the jar or a directory. Please see the SimpleViewer.java example code for documented usage.
Q. Can I get JPedal to use additional fonts not normally available to Java such as those in the Windows or mac font directories?
Yes, using the feature above. Please see the SimpleViewer.java example code for documented usage.
Q. Type3 fonts can look quite 'blocky'. Is there any way to improve this?
Yes. If you use the code PdfDecoder.optimiseType3Rendering=true then Type3 fonts will be drawn slower but using bicubic rescaling.
Text Extraction related questions
Q. The co-ordinates seem to be wrong on rotated pages. What is the problem?
Text on rotated pages can either be extracted with the actual page co-ordinates or with the co-ordinates adjusted to take into account of the rotation. This is controlled by the boolean flag PdfGroupingAlgorithms.useUnrotatedCoords. The default for this is false.
Image related questions
Q. Why do images not appear as clear as text when I increase the scaling in the viewer?
The text and shapes are drawn directly onto a Graphics 2D object and are vectors. The images are bitmaps and are sampled internally to 72dpi for display. It is possible to use the original hires images in the screen display using the method call useHiResScreenDisplay(true) but it will use more memory.
Q. Thumbnails of pages appear with a white background by default. Is it possible to make this transparent?
Yes. Just call the method getPageAsTransparentImage(int pageNumber) rather than getPageAsImage(int pageNumber)
Q. Images do not appear. What has gone wrong?
Assuming it is not a bug, it may be that there is not enough memory to handle the image. This can be particularly true with pages which contain large CCITT images - these are stored in the PDF as 1 bit images but need to be converted to 24 bit color by JPedal. Memory can be increased by starting the program with the -Xmx option. An example would be java -Xmx128M -cp .... which allocates 128 Megabytes to the heap for Java's usage.
Print related questions
Q. Does JPedal support printing?
Yes. It implements the Java Printing Service to provide a complete printing solution.
Q. Why does the page have a rectangular border around it?
By default, JPedal puts a small border around the page onscreen and when printed. This can be disabled with the following:
/**turn off border in printing*/
decode_pdf.disableBorderForPrinting();
(where decode_pdf is an instance of PdfDecoder class)
Q. Why is the page sometimes scaled?
In some modes, JPedal renders the page inside the imageable area defined by the Java Printing Service. If the page will not fit, it scales the page to fit. This avoids part of the page being clipped. JPedal supports options to print with no scaling, shrink to fit and scale to page size. JPedal offers all the scaling options provided by Acrobat and the Enhanced version has a custom print dialog.
Q. Is it possible to print automatically?
Yes. There is a SilentPrinting example setup to show this.
Q. How can I find out what printers are available?
Try the following:-
/**
* choose the printer, testing if printer in list
*/
PrintService[] service=PrinterJob.lookupPrintServices(); //list of printers
for(int i=0;i<count;i++)
System.out.println(service[i].getName());
Q. Is it possible to add an indent for printing?
Yes. The Enhanced version of PdfDecoder includes a method setPrintIndent(int oddPages,int evenPages) to set a value (using PDF units) for both odd and even pages. Call this before printing.
Q. Is it possible to add my own images or text ontop of a PDF for printing?
The commercial version can overlay items for both printing and display. Have a look at the Print tutorial for full details.
Q. JPS seems quite complicated? Where can I obtain more details or help?
JPS is a very complex system and there is lots to learn. IDRsolutions can provide assistance on a consultancy basis. There are lots of details on the Sun Java sites. There is also a print tutorial.
PDF specific questions
Q. Can you clarify how PDF and Adobe fit together?
PDF is an open file specification published by Adobe. The company produces a number of tools such as Distiller and Acrobat to create and process PDF files.
Q. How complete is the PDF implementation in JPedal?
No third-party PDF library can ever be 100%. We have JPedal working with the latest PDF files and have regular releases which fix any issues encountered and aim to ensure that JPedal always leads in features and support. Please read the implementation notes tab for full details.
Q. What about encryption?
JPedal handles standard 40 bit and 128 bit encryption using the RC4 library from The Legion Of The Bouncy Castle (http://www.bouncycastle.org). It will not allow extraction of data unless you have the correct permissions/password.
Q. What about embedded fonts?
We have our own Font renderer to support all the Font types found in PDFs (TT, OT, OTF, T1, CCF, TTC, etc).
Q. How well does it handle output from programs other than Distiller?
It has been tested on PDF files from a huge range of other PDF creation tools including Quartz, PdfWriter, IText, FOP, and Ghostscript, to name a few.
Q. Can I cahnge the background color of a PDF in the Viewer?
Yes. From version 4.40b85 you can set it in the commercial version at the PDF decoder level or in the viewer with this code
If you are just using an instance of PDFDecoder use
Map map=new HashMap();
try {
map.put(JPedalSettings.PAGE_COLOR, args[0]);
decode_pdf.modifyNonstaticJPedalParameters(map);
} catch (PdfException e2) {
e2.printStackTrace();
}
or the recommended way using the Viewer bean
executeCommand(Commands.SETPAGECOLOR, new Object[]{new Integer((int) colorAsRGBvalue)});




