problem while trying to export customer invoice pdf

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi,

I don't know if this as been talked befored,

In Nopcommerce 1.90 while trying to export customer invoice to pdf, nothing happens, but on the error log, it shows this:

? Log type:   CustomerError
? Severity:   11
? Message:   Error generating PDF
? Exception:   System.Security.SecurityException: Request failed. at PdfSharp.Fonts.OpenType.FontData.CreateGdiFontImage(XFont font, XPdfFontOptions options) at PdfSharp.Fonts.OpenType.FontData..ctor(XFont font, XPdfFontOptions options) at PdfSharp.Fonts.OpenType.OpenTypeDescriptor..ctor(XFont font, XPdfFontOptions options) at PdfSharp.Fonts.OpenType.OpenTypeDescriptor..ctor(XFont font) at PdfSharp.Fonts.FontDescriptorStock.CreateDescriptor(XFont font) at PdfSharp.Drawing.XFont.get_Metrics() at PdfSharp.Drawing.XFont.Initialize() at PdfSharp.Drawing.XFont..ctor(String familyName, Double emSize, XFontStyle style, XPdfFontOptions pdfOptions) at MigraDoc.Rendering.FontHandler.FontToXFont(Font font, XPrivateFontCollection pfc, PdfFontEncoding encoding, PdfFontEmbedding fontEmbedding) at MigraDoc.Rendering.ParagraphRenderer.get_CurrentFont() at MigraDoc.Rendering.ParagraphRenderer.CalcCurrentVerticalInfo() at MigraDoc.Rendering.ParagraphRenderer.InitFormat(Area area, FormatInfo previousFormatInfo) at MigraDoc.Rendering.ParagraphRenderer.Format(Area area, FormatInfo previousFormatInfo) at MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel) at MigraDoc.Rendering.FormattedCell.Format(XGraphics gfx) at MigraDoc.Rendering.TableRenderer.FormatCells() at MigraDoc.Rendering.TableRenderer.InitFormat(Area area, FormatInfo previousFormatInfo) at MigraDoc.Rendering.TableRenderer.Format(Area area, FormatInfo previousFormatInfo) at MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel) at MigraDoc.Rendering.FormattedDocument.Format(XGraphics gfx) at MigraDoc.Rendering.DocumentRenderer.PrepareDocument() at MigraDoc.Rendering.PdfDocumentRenderer.PrepareDocumentRenderer(Boolean prepareCompletely) at MigraDoc.Rendering.PdfDocumentRenderer.PrepareRenderPages() at MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument() at NopSolutions.NopCommerce.BusinessLogic.Utils.PDFHelper.PrintOrderToPdf(Order order, Int32 languageId, String filePath) at NopSolutions.NopCommerce.Web.Modules.OrderDetailsControl.lbPDFInvoice_Click(Object sender, EventArgs e) The action that failed was: Demand The type of the first permission that failed was: System.Security.PermissionSet The Zone of the assembly that failed was: MyComputer


Any idea?

Thanks in advance,
Manuel Seromenho
12 years ago
I hope anyone can realy help me, as I'm feeling there is no support for NopCommerce.

Best Regards,
Manuel Seromenho
12 years ago
Ensure that you run nopCommerce in medium trust (required for PDF)
12 years ago
Thanks very much Andrei for the reply!

"Close but no cigar" heheh!

I asked the company where I have my website hosted, they say that they have a customized "trust", in other words, between medium and full trust.

Unfortunately I can't export pdf in medium trust, they momentarily changed to full trust and it worked, but they say it's not secure as it is an shared host.

I saw this topic:
https://www.nopcommerce.com/boards/t/3087/creating-a-pdf-invoice-in-medium-trust-environments-a-solution.aspx?p=1

It seems there is a proposed solution, but does it really works?


Any help would be grateful!

Best Regards,
Manuel Seromenho

(I have installed NOPCOMMERCE 1.9 version)
12 years ago
That solution is outdated. The solution is to run nopCommerce in full trust
12 years ago
Thanks very much for the reply Andrei!



Wow! I'm confused, is it "medium trust" or "full trust" (for pdf exporting) ?

I used the solution provided on that link, but didn't solve the problem.



I'm not sure but I edited web.config file and inserted :
<system.web>
      <trust level="Full"/>
      . . ..


And it works, I'm not sure if my host provider has the possibility of "full trust", but denies it. The truth is that after inserting that line, it is working.

Best Regards,
Manuel Seromenho
12 years ago
jonhy_doe wrote:
I'm confused, is it "medium trust" or "full trust" (for pdf exporting) ?

Manuel,

It's "full trust". It doesn't work in medium trust
12 years ago
a.m. wrote:
I'm confused, is it "medium trust" or "full trust" (for pdf exporting) ?
Manuel,

It's "full trust". It doesn't work in medium trust


Thanks Andrei!

Another aspect that I saw, my online shop seems faster after the change, what should be the reason?

http://www.inforzen.pt


Best Regards,
Manuel Seromenho
12 years ago
No, trust level doesn't affect performance
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.