0

I'm trying to install PdfSharp + MigraDoc + Stream 2.0.1 in a VS2013 C# project. If I use the nuget GUI, it shows the install button, but when clicked it says it's already installed.

If I use the package manager console to uninstall and then re-install the package, the result is "Successfully uninstalled 'PdfSharp.MigraDoc 2.0.1'." and "Successfully installed 'PdfSharp.MigraDoc 2.0.1'.", respectively.

However, following the supposedly successful installation, the nuget GUI does not show the package as installed and there are no references to MigraDoc/PdfSharp in the project, i.e. I can't work with it.

If I install the standard MigraDoc/PdfSharp V1.32 plus V2.0.1, I can work with it, but the streaming functionality does not appear to be there (I am trying this simple snippet but in the PDF file it says image not found).

So my questions are

  1. Why is the package not installing properly?
  2. Do I need both the original V1.32 and 2.0.1?
  3. Are there any other prereqs to use an image from stream?

I hope it's ok to post the three questions as one, but they don't seem to warrant separate posts. The ultimate goal is to put formatted text from HTML in a PDF file, so I could consider alternatives (but this seemed the simplest way).

Any help is greatly appreciated, I'm stuck.

devlock
  • 959
  • 1
  • 9
  • 14
  • IMHO the 2.0.1 version is obsolete. The latest official version 1,50 beta 3 is available on NuGet (include prereleases in the filter) and supports images from strings. Just read your image streams into strings and use them with version 1.50. I never tried that 2.0.1 package and cannot answer your questions. – I liked the old Stack Overflow Feb 10 '16 at 10:59
  • Thanks - this version hadn't come up in the nuget search; following your comment I found the console command, so giving it a go now. – devlock Feb 10 '16 at 11:09
  • no tgetting any joy :-( the image rendered is black and the new PdfSharp version no longer seems to release the file after writing (exception when trying to delete it); – devlock Feb 10 '16 at 11:52
  • Make sure you have the latest version (no need to use a console command to get that) and show some code (in a new question) if things don't work as expected. https://www.nuget.org/packages/PDFsharp-gdi/1.50.4000-beta3b – I liked the old Stack Overflow Feb 10 '16 at 11:58
  • A code snippet that shows how to use an image you have as a byte array with MigraDoc: http://www.pdfsharp.net/wiki/MigraDoc_FilelessImages.ashx – I liked the old Stack Overflow Feb 10 '16 at 15:29
  • hi, thanks, but it's the same as the link I mentioned above, which I've not managed to get to work (image black, file not released) – devlock Feb 10 '16 at 15:32
  • ok, ended up doing it a different way using PdfGenerator.GeneratePdf(myHtml, PdfSharp.PageSize.A4); thanks everybody for their comments – devlock Feb 10 '16 at 16:16

0 Answers0