Hi Alan
Thank you for your reply. I also tried to add the layer using the PDFWriter
object instead of the PDFStamper, which I now know doesnt support layers. Here
is my code:
(My question below the code)
--------------------------------------------------------------------------
//outFile is my concatenated file, built from individual files with layers and
ended up losing them in the concatenation, not sure why, maybe the PDFCopy
Object also doesnt support layers yet?
PdfReader reader3 = new PdfReader(outFile);
Document doc = new Document(reader3.GetPageSizeWithRotation(1));
if (File.Exists("C:\\TEST.PDF"))
File.Delete("C:\\TEST.PDF");
PdfWriter writer;
writer = PdfWriter.GetInstance(doc, (Stream)File.Open("C:\\TEST.PDF",
FileMode.Append, FileAccess.Write));
doc.Open();
PdfLayer layer = new PdfLayer("BaseLayer", writer);
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI,
BaseFont.NOT_EMBEDDED);
PdfContentByte cb = writer.DirectContent;
cb.BeginText();
cb.SetTextMatrix(50, 790);
cb.SetLeading(24);
cb.SetFontAndSize(bf, 18);
cb.BeginLayer(layer);
cb.NewlineShowText("write to layer");
cb.EndLayer();
cb.EndText();
doc.Close();
--------------------------------------------------------------------------
The final doc ends up ONLY with the text -write to layer- but it doesnt have
the content of outfile. I am new to iText, but shouldn't the final doc have
the content of outFile because that is how reader3 and doc where opened?
Thank you
Christian Cruz
Hantz Technology
[EMAIL PROTECTED]
(586) 207-5921
--------------------------------------------------------
THIS COMMUNICATION IS INTENDED ONLY FOR THE USE OF THE INDIVIDUAL OR ENTITY TO
WHICH IT IS ADDRESSED AND CONTAINS OR MAY CONTAIN INFORMATION THAT IS
PRIVILEGED, CONFIDENTIAL OR EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If
the reader of this communication is not the intended recipient (or the employee
or agent responsible for delivering to the intended recipient), you are hereby
notified that any dissemination, distribution, or copying of this communication
is strictly prohibited. If you have received this communication in error,
please disregard and delete this communication. Do not disseminate or retain
any copy of this communication, or any attachments.
--------------------------------------------------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/