Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingManifestResourceException with MigraDoc.Improved v1.32.6372 #2

Open
MovGP0 opened this issue Jan 29, 2019 · 5 comments
Open

Comments

@MovGP0
Copy link

MovGP0 commented Jan 29, 2019

When rendering an image to an PDF, I get the following exception:

(INTERNAL ERROR while formatting error message: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "MigraDoc.Rendering.Resources.Messages.resources" was correctly embedded or linked into assembly "MigraDoc.Rendering" at compile time, or that all the satellite assemblies required are loadable and fully signed.
   at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing\(String fileName\)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet\(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark\)
   at System.Resources.ResourceManager.InternalGetResourceSet\(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark\)
   at System.Resources.ResourceManager.InternalGetResourceSet\(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents\)
   at System.Resources.ResourceManager.GetString\(String name, CultureInfo culture\)
   at MigraDoc.Rendering.Resources.Messages.FormatMessage\(IDs id, Object[] args\))
@MovGP0
Copy link
Author

MovGP0 commented Jan 29, 2019

Project was compiled as .NET Core 2.2

@AVPolyakov
Copy link
Owner

  1. Most likely the path to image is incorrect.
  2. Problem with error message “Image not found” from embedded resource file. I will try to fix this problem.

@MovGP0
Copy link
Author

MovGP0 commented Mar 25, 2019

The image is embedded as BASE64 and still not working. Code is as follows:

// cell is of type MigraDoc.DocumentObjectModel.Tables.Cell
// imageBytes is of type byte[]

if (imageBytes == null || imageBytes.Length == 0) return;

var imageBase64 = "base64:" + Convert.ToBase64String(imageBytes);
cell.AddImage(imageBase64);

@AVPolyakov
Copy link
Owner

BASE64 images are supported starting with version MigraDoc v1.50.

For many reasons, we refused to use MigraDoc. Now we use SharpLayout. SharpLayout supports images from any stream:

cell.Add(new Image().Content(GetStream));

Stream GetStream()
{
    return //Any Stream. For example, File.OpenRead, Assembly.GetManifestResourceStream, MemoryStream.
}

@MovGP0
Copy link
Author

MovGP0 commented Mar 31, 2019

my workaround was to use the source of PDFSharpCore, did some code fixes on the release build, and used ImageSharp to load the file instead of the base64 encoded string.

Not a clean solution, because I now have rendering issues with tables and fonts. But at least the images are working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants