?
Solved

itextsharp + image in pdf

Posted on 2009-12-21
3
Medium Priority
?
687 Views
Last Modified: 2013-11-07
Dear Friends,

you can see the related question, which is solved but the only problem is image,
the image is generating on the fly (barcode image) and added successfully in html but not rendering in pdf.

1. please see the codes in related question
2. the only problem occured is image is not adding in pdf by using the related question solution code.

please let me know the solution asap.

thanx
0
Comment
Question by:virafh
3 Comments
 
LVL 15

Accepted Solution

by:
rajeeshmca earned 750 total points
ID: 26102569
hI VIRAFH,

Imports iTextSharp.text
Imports iTextSharp.text.pdf
Imports System.IO


Protected Sub ImageswithPDFButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ImageswithPDFButton.Click
        Dim imagepath As String = Server.MapPath("Images")
        Dim pdfpath As String = Server.MapPath("PDFs")
        Dim doc As New Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35)
        Dim wri As PdfWriter
        wri = PdfWriter.GetInstance(doc, New FileStream(pdfpath & "/Image1.pdf", FileMode.Create))
        doc.Open()
        doc.Add(New Paragraph("GIF"))
        Dim gif As Image = Image.GetInstance(imagepath & "/calendar.gif")
        doc.Add(gif)
        doc.Close()
    End Sub
0
 
LVL 22

Assisted Solution

by:Mrunal
Mrunal earned 750 total points
ID: 26137521
Hi
try this:

string _ImagePath = Server.MapPath("images/") + "Logo.JPG";
                    iTextSharp.text.Image imgLogo = iTextSharp.text.Image.GetInstance(_ImagePath);
                    imgLogo.Alignment = Element.ALIGN_LEFT;
                    imgLogo.ScalePercent(60);
                    Chunk ckLogo = new Chunk(imgLogo, 0, -75);  // 70 : distance from top to bottom end of image
                    Phrase pLogo = new Phrase();
                    pLogo.Add(ckLogo);
                    document.Add(pLogo);
0
 

Author Closing Comment

by:virafh
ID: 31668863
thanx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Integration Management Part 2
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month17 days, 11 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question