Posted 3 May 2018, 10:40 pm EST
Hi Guys,
I’m using the brand new GrapeCity.Documents.Pdf (V. 1.0.0.105) nuget package in my
.Net Standard 2.0 project.
I have problems with adding elements to the document (see code below g.DrawString(…)).
I always get following exception:
“An unhandled exception of type ‘System.AccessViolationException’ occurred in Grapecity.Documents.Common.dll. Attempted to read or write protected memory. This is often indication that other memory is corrupt.”
I have also downloaded the Visual Studio sample project but there the same exception occurs.
(http://demos.componentone.com/DocumentServices/GcPdfWeb/Samples/List#QuickStart/undefined).
Example Code: The exception occurs at g.DrawString
// Create a new PDF document:
GcPdfDocument doc = new GcPdfDocument();
// Add a page, get its graphics:
GcPdfGraphics g = doc.NewPage().Graphics;
// Render a string into the page:
g.DrawString(“Hello, World!”,
// Use a standard font (the 14 standard PDF fonts are built into GcPdf
// and are always available):
new TextFormat() { Font = StandardFonts.Times, FontSize = 12 },
// GcPdf page coordinates start at top left corner, using 72 dpi by default:
new PointF(72, 72));
// Save the PDF:
doc.Save(stream);
Kind regards,
Gerd