Bug 183809 PDF emitter does not render URLs with specified target correctly
When the hyperlink has specified "_blank" target it's rendered with PdfAction(hyperlink) but when the target is "_parent" or "_top" or "_self" it's rendered with PdfAction.gotoRemotePage(hyperlink, bookmark, false, false) which causes something like "file does not exist" error in PDF viewer. The following change in PDFEmitter from: private PdfAction createPdfAction(String hyperlink, String bookmark, String target, int type) { if ("_blank".equalsIgnoreCase(target)) //$NON-NLS-1$ // Opens the target in a new window. { return new PdfAction(hyperlink); } else ... to: private PdfAction createPdfAction(String hyperlink, String bookmark, String target, int type) { if ("_top".equalsIgnoreCase(target) || //$NON-NLS-1$ "_parent".equalsIgnoreCase(target) || //$NON-NLS-1$ "_blank".equalsIgnoreCase(target) || //$NON-NLS-1$ "_self".equalsIgnoreCase(target)) //$NON-NLS-1$ // Opens the target in a new window. { return new PdfAction(hyperlink); } else ... works for me.
engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java
import java.awt.Color;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.birt.report.engine.api.TOCNode;
import org.eclipse.birt.report.engine.content.IHyperlinkAction;
import org.eclipse.birt.report.engine.content.IStyle;
import org.eclipse.birt.report.engine.layout.PDFConstants;
import org.eclipse.birt.report.engine.layout.TextStyle;
import org.eclipse.birt.report.engine.layout.emitter.IPage;
import org.eclipse.birt.report.engine.layout.pdf.font.FontInfo;
import org.w3c.dom.css.CSSValue;
import com.lowagie.text.BadElementException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.Image;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfAction;
import com.lowagie.text.pdf.PdfAnnotation;
import com.lowagie.text.pdf.PdfBorderDictionary;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfDestination;
import com.lowagie.text.pdf.PdfOutline;
import com.lowagie.text.pdf.PdfTemplate;
import com.lowagie.text.pdf.PdfTextArray;
import com.lowagie.text.pdf.PdfWriter;
public class PDFPage implements IPage