locked
Simple but elegant way to write to a pdf file with some fields picked up from database

    Question

  • G'day.

    I am to work on a little app to pick up data from database, it is then to produce a report in pdf format, nothing fancy, but I find myself newbie to the Windows Store app development words.

    Kindly help me out if you know some good source of info or you have experience in the past or sample simple code will make my day.

    Regards

    Wednesday, June 25, 2014 6:33 AM

Answers

  • There is no in-box API to write PDF files. You will need to find a 3rd party API or implement the format yourself.

    Wednesday, June 25, 2014 6:45 AM
    Owner
  • I would recommend creating a web service that connects to your database (as you would have to do this anyways if your database in not local) and generate a PDF file one the server side of things. This will save you the trouble of trying to figure out how to create a PDF in a Windows Store app (I haven't heard of one yet). To create a PDF on a web service try using the PDFSharp: http://www.pdfsharp.net

    http://rbrundritt.wordpress.com

    Wednesday, June 25, 2014 7:26 PM

All replies

  • There is no in-box API to write PDF files. You will need to find a 3rd party API or implement the format yourself.

    Wednesday, June 25, 2014 6:45 AM
    Owner
  • I would recommend creating a web service that connects to your database (as you would have to do this anyways if your database in not local) and generate a PDF file one the server side of things. This will save you the trouble of trying to figure out how to create a PDF in a Windows Store app (I haven't heard of one yet). To create a PDF on a web service try using the PDFSharp: http://www.pdfsharp.net

    http://rbrundritt.wordpress.com

    Wednesday, June 25, 2014 7:26 PM
  • Rob,

    I worked out using itextsharp which is available at no cost, but the problem with that is the pdf will be generate thru ASP .NET which runs on local host.

    When it comes to windows 8 tablet, does it present any difficulty to get the pdf file generated as if the project runs on the simulator / local machine?

    Million thanks for being resourceful.

    Regards

    Thursday, June 26, 2014 11:22 PM
  • Ricky,

    Many thanks for your recommendation.

    Please have a look at my follow up question with Rob and kindly give me some thought.

    Regards

    Thursday, June 26, 2014 11:24 PM
  • No. General purpose apps (as opposed to side-loaded LOB apps on Windows 8.1 Update) will not be able to communicate with a local web service. You would need to have your database server and web server on a remote system.

    There are commercial PDF API available that you can include with your Windows Store app, but I cannot make any specific recommendations. You should be able to find a few in your favourite search engine. I'm not aware of any free ones, and I don't know how difficult it would be to port something like ITextSharp (but I suspect it wouldn't be trivial if it's doing the rendering with System.Drawing)

    --Rob

    Thursday, June 26, 2014 11:59 PM
    Owner