0

I have a problem I'm not sure can be solved, I wondered if I could ask for help on here.

I am creating an invoice in PDFsharp in C#, I have written the first page displaying strings taken from datagrids along the way. That's all fine.

However I'm coming to the summary page and I need to output the values looping through the datagridview into the PDF. Is that possible within PDFsharp or do I have to go to MigraDoc to do this?

If so, is MigraDoc still supported?

As I cannot get the references into my solution.

Any help would be appreciated.

Thanks.

1 Answers1

0

MigraDoc is still supported.

MigraDoc uses PDFsharp to create PDF files, so everything that can be done with MigraDoc can also be done with PDFsharp only.
MigraDoc supports tables with borders and handles pagebreaks automatically - so for invoices it is most likely a good idea to use MigraDoc and not PDFsharp.
See also:
http://www.pdfsharp.net/wiki/Invoice-sample.ashx

With respect to adding the references, detailed error messages would be helpful.
The source code package of MigraDoc includes samples with Visual Studio solutions and all references.

  • Hi, thanks for getting back to me so quickly. I have added pdf sharp to my project and that's all working fine but I can't add migradoc. I'm not sure if the download is incomplete so when I try and use the invoice example (which I've tried to use as a base previously) my references are not recognised. Also, can you combine the two within one pdf document? Forgive my ignorance, |I've only just started using these tools Many thanks – user3257870 Feb 26 '14 at 13:55
  • When I add the CreateDocument() I have the error that I am missing a directive or assembly reference. – user3257870 Feb 26 '14 at 14:00
  • @user3257870: Do not argue with your compiler: if it says an assembly reference is missing then he is probably right. Did you add the MigraDoc project to your solution? Did you add a reference to the MigraDoc project to your own project? – I liked the old Stack Overflow Feb 26 '14 at 15:37
  • I know, that's my problem, I cannot add migradoc to my project. How do you add it? I've added pdfsharp as normal but I can't for the life of me add migradoc in the same way – user3257870 Feb 26 '14 at 15:40
  • I think its asking for a dll but there isn't any in the migradoc project I have – user3257870 Feb 26 '14 at 15:48
  • @user3257870: you can add a reference to a project (and the compiler will create the DLL as needed) or a reference to a DLL. If you downloaded the source package, add a reference to the VS project - if you downloaded the assembly package, add a reference to the DLL file. My crystal ball is a bit foggy and I cannot see clearly how you try to reference the MigraDoc project (but if it worked for PDFsharp, then adding MigraDoc is just more of the same). – I liked the old Stack Overflow Feb 26 '14 at 15:52
  • Hi, I added pdfsharp with PDFsharp\code\pdfsharp\pdfsharp.csproj. – user3257870 Feb 26 '14 at 16:46
  • Hi, I added pdfsharp with PDFsharp\code\pdfsharp\pdfsharp.csproj. There is no such file in the migradoc folder. All I have are C:\Users\chris\Documents\Visual Studio 2013\Projects\Job Pricing\MigraDoc\code\MigraDoc.DocumentObjectModel – user3257870 Feb 26 '14 at 16:52
  • @user3257870: there should be project files in the folders "MigraDoc\code\MigraDoc.DocumentObjectModel", "MigraDoc\code\MigraDoc.Rendering", and "MigraDoc\code\MigraDoc.RtfRendering". Do you have version 1.32? You can find it here: http://pdfsharp.codeplex.com/releases – I liked the old Stack Overflow Feb 26 '14 at 17:29