Click here to Skip to main content
15,898,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want it to be generated as Horizontal. What changes do I need to do?
the code is given below

C#
using (FileStream fs = new FileStream(appRootDir + fileName, FileMode.Create, FileAccess.Write, FileShare.None))
               // Step 2: Creating iTextSharp.text.Document object


               using (Document doc = new Document(PageSize.A4))
               // Step 3: Creating iTextSharp.text.pdf.PdfWriter object
               // It helps to write the Document to the Specified FileStream

               using (PdfWriter writer = PdfWriter.GetInstance(doc, fs))
               {
                   doc.AddTitle("Example");
                   doc.AddSubject("This is an Example 4 of Chapter 1 of Book 'iText in Action'");
                   doc.AddKeywords("Metadata, iTextSharp 5.4.4, Chapter 1, Tutorial");
                   doc.AddCreator("iTextSharp 5.4.4");
                   doc.AddAuthor("RGU");
                   doc.AddHeader("Nothing", "No Header");


                   doc.Open();





pls help me
Thanks in advance

What I have tried:

I want it to be generated as Horizontal. What changes do I need to do?
Posted
Updated 15-Feb-16 23:56pm
v2

1 solution

I believe the correct terminology is portrait (not vertical) and landscape (not horizontal) - you would have better luck searching if you'd used the correct terms

you need to take this line :-

C#
using (Document doc = new Document(PageSize.A4))


and make it this :-

C#
using (Document doc = new Document(PageSize.A4.Rotate()))
 
Share this answer
 
Comments
Athul MS 16-Feb-16 6:17am    
its working thank you.is ther any another way to print horizontal

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900