*
* @return the PDFGoTo that was found or created
*/
protected PDFGoTo getPDFGoToForID(String targetID, String pvKey) {
// Already a PDFGoTo present for this target? If not, create.
PDFGoTo gt = (PDFGoTo) idGoTos.get(targetID);
if (gt == null) {
String pdfPageRef = (String) pageReferences.get(pvKey);
Point2D.Float position = (Point2D.Float) idPositions.get(targetID);
// can the GoTo already be fully filled in?
if (pdfPageRef != null && position != null) {
// getPDFGoTo shares PDFGoTo objects as much as possible.
// It also takes care of assignObjectNumber and addTrailerObject.
gt = pdfDoc.getFactory().getPDFGoTo(pdfPageRef, position);
} else {
// Not complete yet, can't use getPDFGoTo:
gt = new PDFGoTo(pdfPageRef);
pdfDoc.assignObjectNumber(gt);
// pdfDoc.addTrailerObject() will be called later, from finishIDGoTo()
unfinishedGoTos.add(gt);
}
idGoTos.put(targetID, gt);