yes you're right in every sense.
the code is this:

Document document1 = new Document();

            PdfWriter writer = PdfWriter.GetInstance(document1, new
FileStream( progressivoAppunto + ".pdf", FileMode.Create));
            document1.Open();
            PdfContentByte cb = writer.DirectContent;
                        
                PdfReader reader = new PdfReader("appunto_header.pdf");
                int pages = reader.NumberOfPages;
                for (int j = 0; j < pages; j++)
                {
                    document1.SetPageSize(reader.GetPageSizeWithRotation(j +
1));
                    document1.NewPage();
                    cb.AddTemplate(writer.GetImportedPage(reader, j + 1), 0,
0);
                }

                //--- watermark file, not header and not footer
                byte [] arr= WriteToPdf(fname, "ABCtribe.com");

                FileStream fs = new
FileStream("appunto_orig_watermarked.pdf", FileMode.Create);
                fs.Write(arr, 0, arr.GetLength(0));
                fs.Close();

                //--------  

                reader = new PdfReader("appunto_orig_watermarked.pdf");
                pages = reader.NumberOfPages;
                int pagesDocFinale = pages;
                for (int j = 0; j < pages; j++)
                {
                    int rotation = reader.GetPageRotation(j+1);
                    
                    
                    
                    document1.SetPageSize(reader.GetPageSizeWithRotation(j +
1));
                    document1.NewPage();

                    //--- ruota le pagine se sono per la lunga nel pdf
originale
                    if (rotation == 0)
                    {
                        cb.AddTemplate(writer.GetImportedPage(reader, j +
1), 0, 0);
                    }
                    else
                    {
                        //---
http://stackoverflow.com/questions/3579058/rotating-pdf-in-c-sharp-using-itextsharp
    
                        cb.AddTemplate(writer.GetImportedPage(reader, j +
1), 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(j + 1).Height);
                    }        
                        
                }

                reader = new PdfReader("appunto_footer.pdf");
                pages = reader.NumberOfPages;
                for (int j = 0; j < pages; j++)
                {
                    document1.SetPageSize(reader.GetPageSizeWithRotation(j +
1));
                    document1.NewPage();
                    cb.AddTemplate(writer.GetImportedPage(reader, j + 1), 0,
0);
                }
             
            document1.Close();
------

so i must use PdfCopy instead of PdfWriter? where i can read the docs?
thanks
Valter



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/itextsharp-concatenated-PDFs-loosing-anchors-tp4031791p4031911.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
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

Reply via email to