annotations = delayedAnnotations;
delayedAnnotations = new ArrayList();
}
public PdfArray rotateAnnotations(PdfWriter writer, Rectangle pageSize) {
PdfArray array = new PdfArray();
int rotation = pageSize.getRotation() % 360;
int currentPage = writer.getCurrentPageNumber();
for (int k = 0; k < annotations.size(); ++k) {
PdfAnnotation dic = (PdfAnnotation)annotations.get(k);
int page = dic.getPlaceInPage();
if (page > currentPage) {
delayedAnnotations.add(dic);
continue;
}
if (dic.isForm()) {
if (!dic.isUsed()) {
HashMap templates = dic.getTemplates();
if (templates != null)
acroForm.addFieldTemplates(templates);
}
PdfFormField field = (PdfFormField)dic;
if (field.getParent() == null)
acroForm.addDocumentField(field.getIndirectReference());
}
if (dic.isAnnotation()) {
array.add(dic.getIndirectReference());
if (!dic.isUsed()) {
PdfRectangle rect = (PdfRectangle)dic.get(PdfName.RECT);
if (rect != null) {
switch (rotation) {
case 90: