Convert doc, tiff, excel to pdf

Last post 02-25-2009 2:16 PM by kkonkle. 15 replies.

Sort Posts:

  • Convert doc, tiff, excel to pdf

    12-03-2008, 4:13 AM
    • Member
      34 point Member
    • wistler
    • Member since 06-05-2008, 6:33 AM
    • Posts 19

     Hi

    can i have functionality in my application to conver tiff, doc,excel files to pdf?

    if yes then plz mention any api, tutorial, helping material.

    thanx in advance

  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 6:14 AM
    Answer
    • Member
      477 point Member
    • Metalore
    • Member since 06-04-2008, 8:11 AM
    • Ireland
    • Posts 129

    Hi,

    You can use iTextSharp which has been ported specifically for the .NET framework. It can be downloaded from http://sourceforge.net/projects/itextsharp/

    Add the .dll to your project and you can start converting anything you want to PDF. I use it a lot in work and at home and have had no problems with it - you can do pretty much anything with it.

    Let me know how you get on

    Regards,

    Tony.

    Please mark this post as Answered if my comment helped you, thanks.
  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 6:15 AM
    Answer
    • All-Star
      18,455 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 1:21 PM
    • KARACHI, PAKISTAN
    • Posts 3,385

    http://www.codeproject.com/KB/office/PortableOpenOffice.aspx
    http://www.codeproject.com/KB/files/tifftopdf.aspx

    We All move to our original place.
    Don't forget.

    Imran Baloch MCP, MCTS(ASP.NET 3.5)
  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 6:21 AM
    Answer
    • Member
      477 point Member
    • Metalore
    • Member since 06-04-2008, 8:11 AM
    • Ireland
    • Posts 129

     

    imran_ku07:

    http://www.codeproject.com/KB/office/PortableOpenOffice.aspx
    http://www.codeproject.com/KB/files/tifftopdf.aspx

    Regarding the above, a comment from HybridGuy re this articleis as follows,

    Glad that you are impressed with your code but...memberhybridguy22:52 27 Jul '07  

    Sorry to flame this here, but pretty weak dude, wtf??? rtf to html to wmf, then import to access as blob, then use crystal? That is the single most ridiculous thing I have ever seen - and you people complaining about errors are even worse for trying to implement it. And yes you are using 3rd party libraries if you are using M$-office and crystal to spin a pdf, probably at least 10 dlls involved - talk about bloated. You could have cut all that cr@p out and used a simple open source library like itextsharp - copy and paste ONE FREAKING DLL and it works.

    itextsharp - ported from java based itext, is the way to go if you want to implement exporting data to a pdf from .net based apps with out all the rigamorole of crystal. I've done crystal, it sucks, and I refuse to use it anymore- use active reports instead.

    itextSharp is available for download for free from:
    http://sourceforge.net/projects/itextsharp/[^]

     I would strongly recommend iTextSharp, it is far and away the best implementation for creating and manipulating PDF's...

    Regards,

    Tony.

    Please mark this post as Answered if my comment helped you, thanks.
  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 6:22 AM
    Answer
    • Member
      477 point Member
    • Metalore
    • Member since 06-04-2008, 8:11 AM
    • Ireland
    • Posts 129

    wistler:
    if yes then plz mention any api, tutorial, helping material.
     

    Here is some material to get you started, also...

    http://itextsharp.sourceforge.net/tutorial/index.html

    Regards,

    Tony.

    Please mark this post as Answered if my comment helped you, thanks.
  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 6:28 AM
    Answer
    • Member
      724 point Member
    • aligenius
    • Member since 04-22-2008, 6:09 AM
    • Posts 133

     Hi

    Check these

    http://www.pdfonline.com/
    http://www.codeproject.com/KB/cs/sertf2pdf.aspx
    http://www.codeproject.com/KB/cs/convertdocintootherformat.aspx?df=100&forumid=25071&exp=0&select=1541741
    http://www.codeproject.com/KB/graphics/giospdfnetlibrary.aspx
    http://www.ujihara.jp/iTextdotNET/en/

    regards 

  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 6:54 AM

     

    HI

    How to use this .dll class for my convetion of any thing .pdf

    which class is provided and which function it is provided  in this dll

    pls give me an example using this dll

    Try this

    Regards
    Ravi
    Please click "mark as answer" if this post helped you.
  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 7:06 AM
    • Member
      477 point Member
    • Metalore
    • Member since 06-04-2008, 8:11 AM
    • Ireland
    • Posts 129

    ravi2k7@hotmail.com:
    pls give me an example using this dll
     

    Sure, add the dll as a reference to your project by right clicking on your solution in Visual Studio, then properties. Under references, click the add and add the .dll

    Below is sample code I have used to create and write to PDF...

     

     

                    ' PDF step 1: creation of a document-object
                    Dim document As New Document()
    
                    ' PDF step 2: create a writer that listens to the document and directs a PDF-stream to a file
                    Dim today As String = DateTime.Now.ToString()
    
                    today = Replace(today, "/", "")
                    today = Replace(today, " ", "")
                    today = Replace(today, ":", "")
    
                    fileName = "C:\temp\" + today + ".pdf"
    
                    PdfWriter.GetInstance(document, New FileStream(fileName, FileMode.Create))
    
                    ' PDF step 3: we open the document
                    document.Open()
    
                    ' PDF step 4: add content to the doc
                    Dim header As New PdfPTable(1)
                    header.WidthPercentage = 100
                    header.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER
                    header.DefaultCell.BorderWidth = 0
    
                    Dim content As PdfPTable = New PdfPTable(3)
                    content.WidthPercentage = 100
                    content.DefaultCell.BorderWidth = 1
    
                    Dim row As Data.DataRow
    
                    Dim inTotal As Double = 0
                    Dim outTotal As Double = 0
    
                    content.AddCell("Test1")
                    content.AddCell("Test2")
                    content.AddCell("Test3")
    
                    For Each row In table.Rows
                        'displaying data from table
                        Dim FileDate As String = row("FileDate").ToString()
                        Dim IncTotals As String = (row("IncTotals")).ToString()
                        Dim OutTotals As String = (row("OutTotals")).ToString()
                        Dim SettlementDate As String = (row("SettlementDate")).ToString()
    
                        inTotal += CType(IncTotals, Double)
                        outTotal += CType(OutTotals, Double)
    
                        content.AddCell(FileDate.ToString())
                        content.AddCell(IncTotals.ToString())
                        content.AddCell(OutTotals.ToString())
                    Next
    
                    content.AddCell("")
                    content.AddCell(inTotal.ToString())
                    content.AddCell(outTotal.ToString())
    
                    Dim myDate As String = datePicker.ToString("dd / MM / yyyy")
    
                    header.AddCell("text here")
                    header.AddCell("text here")
                    header.AddCell("text here"))
                    document.Add(header)
                    document.Add(New Chunk(""))
                    document.Add(content)
    
                    ' step 5: we close the document
                    document.Close()
      

     

    Regards,

    Tony.

    Please mark this post as Answered if my comment helped you, thanks.
  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 7:16 AM
    • All-Star
      18,455 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 1:21 PM
    • KARACHI, PAKISTAN
    • Posts 3,385

    Yes ITextSharp, is very good as Metalore say.

     I am also using this in my PDF FORM DESIGNER

    We All move to our original place.
    Don't forget.

    Imran Baloch MCP, MCTS(ASP.NET 3.5)
  • Re: Convert doc, tiff, excel to pdf

    12-03-2008, 7:27 AM

    @metalore

    Hi ,

    I have seen you example but i have little bit confuesion bcz it is written in the form .vb

    so,that i am using c#.net

    Acutally my Requirement is  Iam using file upload control in my solution i have uploaded any file ie .doc,.jpg,.tif,.tiff

    any file i want to convert into .pdf after clicking the upload file

    Help me in this View

    Thank you

    Regards
    Ravi
    Please click "mark as answer" if this post helped you.
  • Re: Convert doc, tiff, excel to pdf

    12-05-2008, 7:24 AM
    • Member
      477 point Member
    • Metalore
    • Member since 06-04-2008, 8:11 AM
    • Ireland
    • Posts 129

    Hi Ravi, there are examples for C# on the link I provided above for examples...also, the comments should help you understand - the logic is the exact same, it's only syntax changes after that!

    For your requirements, you can pass a file as a parameter to iTextSharp and it will convert it automatically for you into PDF. Save the file somewhere once the user uploads it, then pass that location to iText to convert to PDF, then provide user with location of the PDF.

    Let me know how you get on :)

    Regards,

    Tony.

    Please mark this post as Answered if my comment helped you, thanks.
  • Re: Convert doc, tiff, excel to pdf

    12-12-2008, 12:36 PM
    • Member
      4 point Member
    • kkonkle
    • Member since 12-12-2008, 12:31 PM
    • Posts 2

    >> For your requirements, you can pass a file as a parameter to iTextSharp and it will convert it automatically for you into PDF 

    Could you elaborate a little more on this line?  What method do you pass the file into iTextSharp through?

    I am creating a program that has almost the exact same requirement as above.  My users will use a file input box to upload a number of files and then submit the entire sale when they're done.  I need to take whatever they uploaded and convert it to a PDF before I store it in the database.  I've used iTextSharp in the past to merge PDFs, but didn't know you could convert files into PDFs.

    Do you have any sample code that accomplishing a simple conversion?  None of the tutorials on the linked site above seem to show how to convert a file, nor does the code in the post above.

    Thanks.

    /<evin

     

  • Re: Convert doc, tiff, excel to pdf

    12-12-2008, 5:24 PM
    • Star
      11,220 point Star
    • hans_v
    • Member since 01-29-2007, 9:03 PM
    • Posts 1,938

    Metalore:

    For your requirements, you can pass a file as a parameter to iTextSharp and it will convert it automatically for you into PDF. Save the file somewhere once the user uploads it, then pass that location to iText to convert to PDF, then provide user with location of the PDF.

    Can you post a code example? Is it also possible to use iTextSharp to convert a webpage to pdf, by just providing the URL?

  • Re: Convert doc, tiff, excel to pdf

    01-16-2009, 3:14 AM
    • Participant
      1,451 point Participant
    • manojlev
    • Member since 09-08-2008, 10:43 AM
    • Mumbai
    • Posts 277

    Do you have other ways to convert

      doc to pdf using iTextSharp library if yes then plz send on this thread

    Thank You
    Manoj Chavan
    -------------------------------------------
    Web Application Developer(C#.NET, ASP.NET, C++.NET)
    My Blog
    My Site
    Mauli softwares
    Always think high, Always Dream High.
    If this post helps you then plz Mark It as Answer
  • Re: Convert doc, tiff, excel to pdf

    02-25-2009, 11:53 AM
    • Member
      88 point Member
    • denniscy
    • Member since 08-15-2007, 1:22 PM
    • Posts 212

    Is there really a way to convert doc files to pdf using isharp?

Page 1 of 2 (16 items) 1 2 Next >