Hi,
Ive been trying to add an OCG over speicific page(s) whose contents I want to
hide
by adding a blue rectangle layer over it. For some reason, the code seems to
end up
with an unopenable pdf. any pointers? :
PdfReader reader =
PdfDictionary dict = reader.getPageN(pageNum);
Rectangle rect = reader.getPageSize(dict);
System.
PdfStamper stamper =
PdfWriter writer = stamper.getWriter();
writer.setPdfVersion(PdfWriter.
BaseFont bf = BaseFont.createFont();
PdfContentByte cb = stamper.getOverContent(pageNum);
cb.setFontAndSize(bf, 18);
PdfLayer ocg1 =
ocg1.setOn(
cb.beginLayer(ocg1);
cb.rectangle(rect);
BaseColor colorBlue = BaseColor.
cb.setColorFill(colorBlue);
cb.endLayer();
}publicvoidaddOCG(String inputFile) throwsIOException, DocumentException
{newPdfReader(inputFile);intpageCount = reader.getNumberOfPages();intpageNum =
25;out.println("****Addding OCG *********");newPdfStamper(reader,
newFileOutputStream(RESULT4));VERSION_1_5);newPdfLayer("OCG1",
writer);true);BLUE;------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
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