Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. PDFSharp Not Working

PDFSharp Not Working

Scheduled Pinned Locked Moved ASP.NET
sysadminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nccs1234
    wrote on last edited by
    #1

    Hellow Expert, I am using PDFSharp for Create PDF file in my Application It works fine and Generate the PDF file and save it in the specified location in Local host but when i upload this in WEB Server it is not working nor throwing any error please suggest me My code is ---------- if (main_id > 0) { dtInvdata = BLObjectTrans.selectInvoiceMasterfromInvNO(invNO, main_id); } string filename1 = "invoice.pdf"; File.Copy(Path.Combine(Server.MapPath("template_bank_debit_pdf/"), filename1), Path.Combine(Directory.GetCurrentDirectory(), filename1), true); //open pdf document filename1 = Path.Combine(Server.MapPath("template_bank_debit_pdf/"), filename1); PdfDocument inputDocument1 = PdfReader.Open(filename1, PdfDocumentOpenMode.Import); PdfDocument OutPutDoc = new PdfDocument(); int count = inputDocument1.PageCount; if (count > 0) { PdfPage pageOut = OutPutDoc.AddPage(inputDocument1.Pages[0]); XGraphics gfx = XGraphics.FromPdfPage(pageOut); XTextFormatter tf = new XTextFormatter(gfx); XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always); XFont font = new XFont("Times New Roman", 9, XFontStyle.Italic, options); XFont font1 = new XFont("Times New Roman", 9, XFontStyle.Regular, options); XFont font2 = new XFont("Times New Roman", 10, XFontStyle.Regular, options); XFont font3 = new XFont("Times New Roman", 10, XFontStyle.Bold, options); XFont font4 = new XFont("Times New Roman", 20, XFontStyle.Underline, options); gfx.DrawString("SUBSCRIPTION INVOICE NUMBER:" + dtInvdata.Rows[0]["inv_no"].ToString(), font4, XBrushes.Black, new XRect(0, 175, pageOut.Width, pageOut.Height), XStringFormats.TopCenter); gfx.DrawString("MEMBERSHIP NUMBER:", font3, XBrushes.Black, new XRect(57, 320, pageOut.Width, pageOut.Height), XStringFormats.TopLeft); gfx.DrawString("DATE:", font3, XBrushes.Black, new XRect(57, 300, pageOut.Width, pageOut.Height), XStringFormats.TopLeft); gfx.DrawString("MEMBERSHIP TYPE:", font3, XBrushes.Black, new XRect(80, 320, pageOut.Width, pageOut.Height), XStringFormats.TopCenter); gfx.DrawString("SUBSCRIPTION AMOUNT:", font3, XB

    C 1 Reply Last reply
    0
    • N nccs1234

      Hellow Expert, I am using PDFSharp for Create PDF file in my Application It works fine and Generate the PDF file and save it in the specified location in Local host but when i upload this in WEB Server it is not working nor throwing any error please suggest me My code is ---------- if (main_id > 0) { dtInvdata = BLObjectTrans.selectInvoiceMasterfromInvNO(invNO, main_id); } string filename1 = "invoice.pdf"; File.Copy(Path.Combine(Server.MapPath("template_bank_debit_pdf/"), filename1), Path.Combine(Directory.GetCurrentDirectory(), filename1), true); //open pdf document filename1 = Path.Combine(Server.MapPath("template_bank_debit_pdf/"), filename1); PdfDocument inputDocument1 = PdfReader.Open(filename1, PdfDocumentOpenMode.Import); PdfDocument OutPutDoc = new PdfDocument(); int count = inputDocument1.PageCount; if (count > 0) { PdfPage pageOut = OutPutDoc.AddPage(inputDocument1.Pages[0]); XGraphics gfx = XGraphics.FromPdfPage(pageOut); XTextFormatter tf = new XTextFormatter(gfx); XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always); XFont font = new XFont("Times New Roman", 9, XFontStyle.Italic, options); XFont font1 = new XFont("Times New Roman", 9, XFontStyle.Regular, options); XFont font2 = new XFont("Times New Roman", 10, XFontStyle.Regular, options); XFont font3 = new XFont("Times New Roman", 10, XFontStyle.Bold, options); XFont font4 = new XFont("Times New Roman", 20, XFontStyle.Underline, options); gfx.DrawString("SUBSCRIPTION INVOICE NUMBER:" + dtInvdata.Rows[0]["inv_no"].ToString(), font4, XBrushes.Black, new XRect(0, 175, pageOut.Width, pageOut.Height), XStringFormats.TopCenter); gfx.DrawString("MEMBERSHIP NUMBER:", font3, XBrushes.Black, new XRect(57, 320, pageOut.Width, pageOut.Height), XStringFormats.TopLeft); gfx.DrawString("DATE:", font3, XBrushes.Black, new XRect(57, 300, pageOut.Width, pageOut.Height), XStringFormats.TopLeft); gfx.DrawString("MEMBERSHIP TYPE:", font3, XBrushes.Black, new XRect(80, 320, pageOut.Width, pageOut.Height), XStringFormats.TopCenter); gfx.DrawString("SUBSCRIPTION AMOUNT:", font3, XB

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      nccs1234 wrote:

      It works fine and Generate the PDF file and save it in the specified location in Local host but when i upload this in WEB Server it is not working nor throwing any error please suggest me

      A deployment problem always means two things 1 - there's nothing wrong with your code, so why post it 2 - something is different on the server ( so tell us the things you checked, like, is PDF sharp's dll on the server )

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups