On 21/08/2012 2:25, Sterling Rouse wrote:
When I create the document from scratch using a PdfWriter and its direct content, the sticky note displays properly on both the desktop and in iOS. However, when I use a PdfStamper and its direct over content to edit an existing PDF, the annotation is invisible on the desktop unless I manage to find it with my cursor and click on it. It doesn't appear to display at all on iOS, although it may simply be impossible to find it.
I've tried to reproduce your problem, and I didn't succeed. I created a PDF with an annotation: annot_test.pdfI used AnnotTest.java to add a large gray rectangle under the existing content and some text on top of the existing content. The result is annot-test.pdf
As expected, the annotation is still visible on top of the gray rectangle, and it even covers the text because an annotation isn't part of the content: it's something that is added on top over everything.
You'll have to provide the code you wrote to create the annotation as well as the code that uses PdfStamper if you want help on the mailing-list.
<<< text/html; name="annot_test.pdf": Unrecognized >>>
<<< text/html; name="annot-test.pdf": Unrecognized >>>
package examples.stamper;
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
public class AnnotTest {
public static void main(String[] args) throws IOException,
DocumentException {
PdfReader reader = new PdfReader("resources/annot_test.pdf");
PdfStamper stamper = new PdfStamper(reader, new
FileOutputStream("results/annot-test.pdf"));
PdfContentByte cb1 = stamper.getUnderContent(1);
PdfContentByte cb2 = stamper.getOverContent(1);
cb1.setColorFill(BaseColor.GRAY);
cb1.rectangle(0, 0, 595, 842);
cb1.fill();
ColumnText.showTextAligned(cb2, Element.ALIGN_LEFT, new
Phrase("TESTING"), 200, 700, 45);
stamper.close();
}
}
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
