Note that there are some explanatory texts on larger screens.

plurals
  1. POitextsharp pdf creation run on local not in server
    primarykey
    data
    text
    <p>I create a PDF file using iTextSharp and it's stored in my system desktop and opens successfully in my local system. Now if I upload the same code to a server, no error occurs and the PDF file isn't created. This is my partial code to create and open pdf.</p> <pre><code>PdfWriter.GetInstance(doc, new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Out.pdf", FileMode.Create)); doc.Open(); DataView DView = (DataView)Session["data_value"]; dtData = DView.ToTable(); dr = dtData.Select("fldemp_no='" + Session["EmployeeID"].ToString() + "'"); doc.NewPage(); iTextSharp.text.Image ObjImg = iTextSharp.text.Image.GetInstance(Server.MapPath("~/Bin/Head.png")); ObjImg.Alignment = iTextSharp.text.Image.ALIGN_CENTER; ObjImg.ScaleToFit(220f, 150f); ObjImg.SpacingBefore = 13f; ObjImg.SpacingAfter = 1f; doc.Add(ObjImg); maintable = new PdfPTable(1); cell = new PdfPCell(new Phrase("Pay Slip for the month of " + dr[0]["fldmonth"].ToString(), fnt1)); cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.Border = 0; maintable.AddCell(cell); doc.Add(maintable); maintable = new PdfPTable(2); empdetright = new PdfPTable(2); empdetleft = new PdfPTable(2); cell = new PdfPCell(new Phrase("Emp No", fnt1)); cell.Border = 0; empdetright.AddCell(cell); cell = new PdfPCell(new Phrase(": " + dr[0]["fldemp_no"].ToString(), fnt1)); cell.Border = 0; empdetright.AddCell(cell); cell = new PdfPCell(new Phrase("Emp Name", fnt1)); cell.Border = 0; empdetright.AddCell(cell); cell = new PdfPCell(new Phrase(": " + dr[0]["fldempname"].ToString(), fnt1)); cell.Border = 0; empdetright.AddCell(cell); doc.Close(); Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/out.pdf"); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload