-
Bug
-
Resolution: Duplicate
-
P3
-
7, 8, 9
-
x86
-
windows_7
FULL PRODUCT VERSION :
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When printing HTML text via an editor pane, a "left double quotation mark" character is sometimes printed as a "o grave accent".
Spacing around the character is sometimes also incorrect.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start the test program. Click on Print.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The double left quotation mark is printed as a quotation mark and spacing around the character is respected.
ACTUAL -
The quotation marks are sometimes printed as accentuated o characters.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class Case65093 {
static String htmlText = "<html>"
+ "<h3><span style=\" text-decoration: underline;\">“</span></h3>"
+ "<h3><u>“</u></h3>"
+ "<h3><u>“ITEM</u></h3>"
+ "<h3><u>“ITEM”</u></h3>"
+ "<h3><u>COL “ITEM”</u></h3>"
+ "<h3><u>COLU “ITEM”</u></h3>"
+ "<h3><u>COLUM “ITEM”</u></h3>"
+ "<p><span style=\" text-decoration: underline;\">“</span></p>"
+ "<p><u>“</u></p>"
+ "<p><u>“ITEM</u></p>"
+ "<p><u>“ITEM”</u></p>"
+ "<p><u>COL “ITEM”</u></p>"
+ "<p><u>COLU “ITEM”</u></p>"
+ "<p><u>COLUM “ITEM”</u></p>"
;
private static void createAndShowGUI() {
JFrame f = new JFrame("Swing Paint Demo");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(250,250);
JButton printButton = new JButton("Print");
printButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
print();
}
});
f.setContentPane(printButton);
f.setVisible(true);
}
private static void print() {
PrinterJob printerJob = PrinterJob.getPrinterJob();
printerJob.setPrintable(new Printable() {
@Override
public int print(Graphics graphics, PageFormat pageFormat,
int pageIndex) throws PrinterException {
graphics.translate((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY());
graphics.drawLine(0, 0, (int)pageFormat.getWidth(), (int)pageFormat.getHeight());
JEditorPane editorPane = new JEditorPane("text/html", htmlText);
editorPane.setSize((int)pageFormat.getImageableWidth(), (int)pageFormat.getImageableHeight());
editorPane.print(graphics);
return pageIndex == 0 ? PAGE_EXISTS : NO_SUCH_PAGE;
}
});
try {
printerJob.print();
} catch (PrinterException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
createAndShowGUI();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use Java 6 instead of Java 7.
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When printing HTML text via an editor pane, a "left double quotation mark" character is sometimes printed as a "o grave accent".
Spacing around the character is sometimes also incorrect.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start the test program. Click on Print.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The double left quotation mark is printed as a quotation mark and spacing around the character is respected.
ACTUAL -
The quotation marks are sometimes printed as accentuated o characters.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class Case65093 {
static String htmlText = "<html>"
+ "<h3><span style=\" text-decoration: underline;\">“</span></h3>"
+ "<h3><u>“</u></h3>"
+ "<h3><u>“ITEM</u></h3>"
+ "<h3><u>“ITEM”</u></h3>"
+ "<h3><u>COL “ITEM”</u></h3>"
+ "<h3><u>COLU “ITEM”</u></h3>"
+ "<h3><u>COLUM “ITEM”</u></h3>"
+ "<p><span style=\" text-decoration: underline;\">“</span></p>"
+ "<p><u>“</u></p>"
+ "<p><u>“ITEM</u></p>"
+ "<p><u>“ITEM”</u></p>"
+ "<p><u>COL “ITEM”</u></p>"
+ "<p><u>COLU “ITEM”</u></p>"
+ "<p><u>COLUM “ITEM”</u></p>"
;
private static void createAndShowGUI() {
JFrame f = new JFrame("Swing Paint Demo");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(250,250);
JButton printButton = new JButton("Print");
printButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
print();
}
});
f.setContentPane(printButton);
f.setVisible(true);
}
private static void print() {
PrinterJob printerJob = PrinterJob.getPrinterJob();
printerJob.setPrintable(new Printable() {
@Override
public int print(Graphics graphics, PageFormat pageFormat,
int pageIndex) throws PrinterException {
graphics.translate((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY());
graphics.drawLine(0, 0, (int)pageFormat.getWidth(), (int)pageFormat.getHeight());
JEditorPane editorPane = new JEditorPane("text/html", htmlText);
editorPane.setSize((int)pageFormat.getImageableWidth(), (int)pageFormat.getImageableHeight());
editorPane.print(graphics);
return pageIndex == 0 ? PAGE_EXISTS : NO_SUCH_PAGE;
}
});
try {
printerJob.print();
} catch (PrinterException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
createAndShowGUI();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use Java 6 instead of Java 7.
- duplicates
-
JDK-6784965 Printing JTable using Sans Serif 11pt is broken
- Open
- relates to
-
JDK-6784965 Printing JTable using Sans Serif 11pt is broken
- Open