Hi,


Is there any option to shrink / scale an existing PDF file and generate a
new file with different layout ( width and height)



I am having a Template with dimension 11.94 / 8.75 inch and which having
form fields



I am able to fill the form fields dynamically(working fine)



And I have a requirement to generate A4 or Letter size PDF files from
existing Templates.



A4 – 11.69 / 8.26 inch



Letter – 11 / 8.5 inch



To achieve this I tried to copy the template content to a document which is
having the Page Size of A4 or Letter.



       string fileNameExisting = @"C:\Path\ New.pdf";

       PdfReader reader = new PdfReader(exists);

            Document document = new Document();



            Rectangle rectangleObject = new Rectangle(PageSize
.LETTER.Rotate());



            document.SetPageSize(rectangleObject);



            PdfWriter writer = PdfWriter.GetInstance(document, new
FileStream(exists.Replace(".pdf", "NewLETTER.pdf"), FileMode.Create));



            document.Open();

            PdfContentByte cb = writer.DirectContent;

            PdfImportedPage page = writer.GetImportedPage(reader, 1);

            page.SetFlatness(1);

            document.NewPage();

            cb.AddTemplate(page,0,0);

                           document.Close();



I am able to generate the PDF in both A4 and Letter size



But the problem is the template is not completely fitting into the Page
size specified, its truncating from bottom and right



Can we shrink / scale the PDF content and fit into the Layouts( A4 or
Letter )





-- 
Regards,
Chandravathi
9866000296
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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