I think there is method to do it

..Actualy I dont have much experies in Itextsharp
but I m creating  complex tables and I but the valus inside it  the add  to
PdfDoc,

This is an example I hope will help you

            Rectangle r = new Rectangle(829, 560);
            Document pdfDoc = new Document(PageSize.A4.Rotate());
            PdfWriter writer = PdfWriter.GetInstance(pdfDoc,
Page.Response.OutputStream);



            // writer.PageEvent = new MyFooter();

            pdfDoc.SetMargins(30f, 30f, 1f, 1f);
            pdfDoc.Open();

            for (int i = 0; i <= dgvEmployee.Rows.Count; i = i + 12)
            {
                iTextSharp.text.pdf.PdfPTable maintable = new
iTextSharp.text.pdf.PdfPTable(1);
                maintable.WidthPercentage = 105;

                iTextSharp.text.pdf.PdfPCell headercell = new
iTextSharp.text.pdf.PdfPCell(headeetable());// here I add Table
                headercell.FixedHeight = 120;
                headercell.Border = 0;
                headercell.HorizontalAlignment = 1;
                maintable.AddCell(headercell);



                iTextSharp.text.pdf.PdfPCell maincell = new
iTextSharp.text.pdf.PdfPCell(datatable(i)); // also here add Table
                maintable.AddCell(maincell);

                iTextSharp.text.pdf.PdfPCell footercell = new
iTextSharp.text.pdf.PdfPCell(footertable()); // also here add Table
                footercell.FixedHeight = 150;
                footercell.Border = 0;
                maintable.AddCell(footercell);




                pdfDoc.Add(maintable);
                pdfDoc.SetMargins(30f, 30f, 1f, 1f);
                pdfDoc.NewPage();
            }
            pdfDoc.Close();

            Page.Response.ContentType = "application/pdf";
            Page.Response.AddHeader("content-disposition",
"attachment;filename=" + DateTime.Now.Day + "_" + DateTime.Now.Month + "_"
+ DateTime.Now.Year + ".pdf");
            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Page.Response.Write(pdfDoc);
            Page.Response.End();


=================================

 private PdfPTable headeetable()
    {
        Font arabicfont = new Font(nationalBase, 13f, Font.NORMAL);

        //----------------------------------------------------- frist the
lif side table-----------------------------------------
        iTextSharp.text.pdf.PdfPTable tablelift = new
iTextSharp.text.pdf.PdfPTable(3);
        tablelift.WidthPercentage = 30;
        tablelift.RunDirection = PdfWriter.RUN_DIRECTION_RTL;




        //----------------------------------------------------- End First
Row-----------------------------------------

        //----------------------------------------------------- Start 2ed
row-----------------------------------------
        Paragraph Pheader = new Paragraph(new Phrase("but your fix values
here ", arabicfont));
        Pheader.Add(Chunk.NEWLINE);
        Pheader.Add(new Phrase("but your fix values here ", arabicfont));

        iTextSharp.text.pdf.PdfPCell cell4 = new
iTextSharp.text.pdf.PdfPCell(Pheader);
        cell4.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
        cell4.FixedHeight = 80;
        cell4.Border = 0;
        cell4.HorizontalAlignment = 0;
        tablelift.AddCell(cell4);



        iTextSharp.text.Image gif =
iTextSharp.text.Image.GetInstance(Server.MapPath("../../Images/MOClogo.jpg"));
        gif.ScaleAbsolute(130, 80);
        iTextSharp.text.pdf.PdfPCell cell2 = new
iTextSharp.text.pdf.PdfPCell(gif);
        cell2.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
        cell2.FixedHeight = 80;
        cell2.Border = 0;

        cell2.HorizontalAlignment = 1;
        tablelift.AddCell(cell2);


        string st ="but your fix values here " +
Session["CountryName"].ToString();
        Paragraph PheaderR = new Paragraph(new Phrase(st, arabicfont));
        PheaderR.Add(Chunk.NEWLINE);
        PheaderR.Add(new Phrase("but your fix values here ", arabicfont));

        iTextSharp.text.pdf.PdfPCell cell6 = new
iTextSharp.text.pdf.PdfPCell(PheaderR);
        cell6.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
        cell6.FixedHeight = 80;
        cell6.Border = 0;
        cell6.HorizontalAlignment = 1;
        tablelift.AddCell(cell6);



        //----------------------------------------------------- end 2ed
Row-----------------------------------------

        //----------------------------------------------------- Start 3ed
row-----------------------------------------


        st = "Diplomate Salaries " + Session["EmbassyName"].ToString() + "
لشهر" + Session["DipSalMonth"].ToString() + " " +
Session["DipSalYear"].ToString();
        iTextSharp.text.pdf.PdfPCell cell7 = new
iTextSharp.text.pdf.PdfPCell(new Phrase(st, arabicfont));
        cell7.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
        cell7.FixedHeight = 35;
        cell7.Border = 0;
        cell7.Colspan = 3;
        cell7.HorizontalAlignment = 1;
        tablelift.AddCell(cell7);


        return tablelift;




On 6 May 2013 16:42, Anil George <anil.geo...@passporthealth.com> wrote:

> Awesome! Thank you so much. I have another question though, can you do the
> pdfdoc.add at a particular area in the document?****
>
> ** **
>
> Anil George****
>
> *Senior Web Developer*****
>
> *[image: healthworks-logo]*HEALTHWORKS a division of****
>
> PASSPORTHEALTH ****
>
> COMMUNICATIONS INC.****
>
> 1265 Drummers La., Suite 202****
>
> Wayne, PA 19087****
>
> ** **
>
> 610-994-0302****
>
> 610-354-0900 ext. 302 (Toll Free)****
>
> anil.geo...@passporthealth.com****
>
> ** **
>
> http://www.passporthealth.com****
>
> ** **
>
> CONFIDENTIALITY NOTICE: This e-mail communication and all attachments are
> for the sole use of the intended recipient(s) and may contain confidential
> and privileged information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended recipient, please
> contact the sender by replying to this e-mail message and delete all copies
> and attachments of the original message.****
>
> ** **
>
> *From:* Mohammed AlSayani [mailto:mohammed.alsay...@gmail.com]
> *Sent:* Monday, May 06, 2013 9:33 AM
> *To:* Post all your questions about iText here
> *Subject:* Re: [iText-questions] data:image/bmp;base64 to pdf question****
>
> ** **
>
> I use  this in my website  but Im getting the tiff images  from DB as Byte
> ****
>
> may it help you ****
>
>
>
>   if (memoryStream != null)
>                     {
>
>                         var imageFile =
> System.Drawing.Image.FromStream(memoryStream);
>                         var frameDimensions = new
> System.Drawing.Imaging.FrameDimension(imageFile.FrameDimensionsList[0]);
>                         var numberOfFrames =
> imageFile.GetFrameCount(frameDimensions);
>                         var paths = new string[numberOfFrames];
>                         for (int intFrame = 0; intFrame < numberOfFrames;
> ++intFrame)
>                         {
>                             imageFile.SelectActiveFrame(frameDimensions,
> intFrame);
>                             var bmp = new Bitmap(imageFile);
>                             iTextSharp.text.Image img =
> iTextSharp.text.Image.GetInstance(bmp,
> System.Drawing.Imaging.ImageFormat.Bmp);
>                             // scale the image to fit in the page
>                             img.ScaleAbsolute(pdfDoc.PageSize.Width,
> pdfDoc.PageSize.Height);
>                             pdfDoc.Add(img);
>                             pdfDoc.SetMargins(1, 1f, 1f, 1f);
>                             pdfDoc.NewPage();
>
>                             bmp.Dispose();
>
>                         }****
>
> ** **
>
> On 6 May 2013 16:26, Anil George <anil.geo...@passporthealth.com> wrote:**
> **
>
> Hi everyone, quick question.
> Does anyone know how to convert a data:image/bmp;base64 from a html page
> to a pdf via iText?
>
> Anil George
> Senior Web Developer
> HEALTHWORKS a division of
> PASSPORTHEALTH
> COMMUNICATIONS INC.
> 1265 Drummers La., Suite 202
> Wayne, PA 19087
>
> 610-994-0302
> 610-354-0900 ext. 302 (Toll Free)
> anil.geo...@passporthealth.com
>
> http://www.passporthealth.com
>
> CONFIDENTIALITY NOTICE: This e-mail communication and all attachments are
> for the sole use of the intended recipient(s) and may contain confidential
> and privileged information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended recipient, please
> contact the sender by replying to this e-mail message and delete all copies
> and attachments of the original message.
>
>
>
> ------------------------------------------------------------------------------
> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
> Get 100% visibility into your production application - at no cost.
> Code-level diagnostics for performance bottlenecks with <2% overhead
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap1
> _______________________________________________
> 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****
>
>
>
>
> -- ****
>
> Best Regards
> ---------------------------
> *Mohammed Hashem*
> Web Developer @ ArabSea.
> www.arabsea.com
> 00966 - 538 766 152****
>
>
> ------------------------------------------------------------------------------
> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
> Get 100% visibility into your production application - at no cost.
> Code-level diagnostics for performance bottlenecks with <2% overhead
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap1
> _______________________________________________
> 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
>



-- 
Best Regards
---------------------------
*Mohammed Hashem*
Web Developer @ ArabSea.
www.arabsea.com
00966 - 538 766 152

<<image001.png>>

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
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