Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8169237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:47:04+00:00 2026-06-06T20:47:04+00:00

I create a PDF file using itextsharp. It’s created successfully and open with adobe

  • 0

I create a PDF file using itextsharp. It’s created successfully and open with adobe reader 9 not in adobe reader 7 and 8. Please help me to fix this error.

This is my partial code :

      try
    {
        //yourFont = BaseFont.CreateFont(Application.StartupPath + "/verdana.TTF", BaseFont.WINANSI, BaseFont.EMBEDDED);
        pgSize = new iTextSharp.text.Rectangle(320, 455);

        doc = new Document(pgSize, 15, 5, 12, 4);
        fnt = new iTextSharp.text.Font(yourFont, 7, 3);
        fnt1 = new iTextSharp.text.Font(yourFont, 5, 0);
        fnt2 = new iTextSharp.text.Font(yourFont, 3, 2);
        fnt3 = new iTextSharp.text.Font(yourFont, 4, 6);


        PdfWriter.GetInstance(doc, new FileStream(Server.MapPath("Payslip.pdf"), FileMode.Create));
        //PdfWriter.GetInstance(doc, new FileStream(Server.MapPath("Payslip.pdf"), FileMode.Create)); //Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Payslip.pdf"

        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(Server.MapPath("Payslip.pdf"));

The above code is run on local machine not on server. Please help me to fix this error..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:47:05+00:00Added an answer on June 6, 2026 at 8:47 pm

    Process.Start will attempt to open the file in the computer it is running (the server).

    This is unlikely to be what you want. You should be uploading the file to the browser and let it decide (using Response.WriteFile, for instance).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to open the PDF file after created using iTextSharp on ASP.Net? I don't
I create a PDF file using iTextSharp and it's stored in my system desktop
How do one create PDF in memorystream instead of physical file using itextsharp. The
I want to create a PDF file using zend_pdf. But this way seems not
I'm using AlivePDF to create a PDF file, then save it to the desktop.
I am using iTextSharp to create a PDF document in C#. I would like
I am working in LaTeX, and when I create a pdf file (using LaTeX
am using ghostscript to create pdf file from postscript file. My PS file, doesn't
I'm using code to create a PDF File. Works. But: I want my whole
Is it possible to create a thumbnail image from a PDF file using Coldfusion

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.