Results 1 to 2 of 2

Thread: [RESOLVED] Problem with iTextSharp PDF when publishing app

  1. #1

    Thread Starter
    Member mdukuen's Avatar
    Join Date
    Sep 2001
    Location
    Mar del Plata, Argentina.
    Posts
    35

    Resolved [RESOLVED] Problem with iTextSharp PDF when publishing app

    Hello, please apologize my english, i am from Argentina.
    I have an Vb.net app, that works fine when testing in localhost, but does not work when publishing it.
    A button opens an aspx page (PdfPrint) in a new tab... In page_load of "PdfPrint.aspx" page i make a "Call PdfSub".
    The PdfSub do some searches, that works fine always, an then create a PDF using iTextSharp. When testing in localhost work ok, but when publishing to my server i get the following error (i traslated to english...)

    Server Error in '/' Application.
    Resource not found (or somethnig like this)
    Description: HTTP 404. The resource you are looking .....
    URL requested: /PdfPrint.aspx

    The PdfSub do something like this:

    HttpContext.Current.Response.ContentType = "application/pdf"
    HttpContext.Current.Response.AddHeader("content-disposition", "inline;filename=NewDocument.pdf")
    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)

    Dim PdfTable As New PdfPTable(Columnas)
    Dim pdfDoc As New iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 30, 30, 25, 25)
    PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream)

    pdfDoc.Open()

    Dim Tif As iTextSharp.text.Image, p1 As New Phrase
    Tif = iTextSharp.text.Image.GetInstance("http://www.somesite.com.ar/someimage.jpg")
    pdfDoc.Add(Tif)

    pdfDoc.Close()
    HttpContext.Current.Response.Write(pdfDoc)
    HttpContext.Current.Response.End()

    When testing in localhost using Vs2013 works ok, i click button and a new tab is opened with PDF file in it... When publishing the app, tehe new tab is opened, but with error message. Filename problem?
    I suspect some file name or fle path problem, but i can solve it, please help me.
    Thank you very much!
    Mariano Dukuen
    *** Please apologize my english ***

  2. #2

    Thread Starter
    Member mdukuen's Avatar
    Join Date
    Sep 2001
    Location
    Mar del Plata, Argentina.
    Posts
    35

    Re: Problem with iTextSharp PDF when publishing app

    Ok solved. Was my mistake when open "PdfPrint.aspx":

    Private Sub cmdGenCC_Click(sender As Object, e As EventArgs) Handles cmdGenCC.Click
    Response.Write("<script> window.open('../PdfPrint.aspx?Tipo=1','_blank'); </script>")
    End Sub

    This "../" is incorrect. I dont know why work when in localhost, and does not work when publishing... Without "../" it works in both cases!

    Thanks.
    Mariano Dukuen
    *** Please apologize my english ***

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width