Print Page | Close Window

SaveToString() throws Exception

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=989
Printed Date: 13 May 25 at 8:36AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: SaveToString() throws Exception
Posted By: piehl
Subject: SaveToString() throws Exception
Date Posted: 24 Nov 08 at 10:03AM
Hi Forum, hi Ingo,

still working with C# .NET Framework 3.5
but upgrading to iSEDQuickPDF.dll v6.02 Beta
there is an other curious behaviour I found:

My Unit Test run,
using iSEDQuickPDF statics to create several documents,
saving to file and saving to string.

The method SaveToString() throws an "AccessViolationException",
shown below ->

// DOC 1.1 -> File
int docId = QuickPdfNativeMethods.NewDocument();
QuickPdfNativeMethods.SetMeasurementUnits(MeasurementUnit.Millimeters);
QuickPdfNativeMethods.SetOrigin(Origin.TopLeft);
QuickPdfNativeMethods.SetPageSize("A4 Landscape");

int fontId = QuickPdfNativeMethods.AddTrueTypeFont("Arial", 0);
//int fontId = QuickPdfNativeMethods.AddTrueTypeFont("Arial", 1);
//int fontId = QuickPdfNativeMethods.AddStandardFont(StandardFont.Helvetica);

QuickPdfNativeMethods.SelectFont(fontId);
QuickPdfNativeMethods.SetTextSize(12);
QuickPdfNativeMethods.DrawText(10, 10, "Hello World:"); }
QuickPdfNativeMethods.SaveToFile(@"C:\Buffer\PdfTest1.pdf");
QuickPdfNativeMethods.RemoveDocument(docId);

// DOC 1.2 -> String
docId = QuickPdfNativeMethods.NewDocument();
QuickPdfNativeMethods.SetMeasurementUnits(MeasurementUnit.Millimeters);
QuickPdfNativeMethods.SetOrigin(Origin.TopLeft);
QuickPdfNativeMethods.SetPageSize("A4 Landscape");

fontId = QuickPdfNativeMethods.AddTrueTypeFont("Arial", 0);
// fontId = QuickPdfNativeMethods.AddTrueTypeFont("Arial", 1);
// fontId = QuickPdfNativeMethods.AddStandardFont(StandardFont.Helvetica);

QuickPdfNativeMethods.SelectFont(fontId);
QuickPdfNativeMethods.SetTextSize(12);
QuickPdfNativeMethods.DrawText(10, 10, "Hello World:");
string sPdf = QuickPdfNativeMethods.SaveToString();
// throw Exception
QuickPdfNativeMethods.RemoveDocument(docId);

// DOC 2.1 -> Datei
docId = QuickPdfNativeMethods.NewDocument();
QuickPdfNativeMethods.SetMeasurementUnits(MeasurementUnit.Millimeters);
QuickPdfNativeMethods.SetOrigin(Origin.TopLeft);
QuickPdfNativeMethods.SetPageSize("A4 Landscape");

fontId = QuickPdfNativeMethods.AddTrueTypeFont("Arial", 0);
// fontId = QuickPdfNativeMethods.AddTrueTypeFont("Arial", 1);
// fontId = QuickPdfNativeMethods.AddStandardFont(StandardFont.Helvetica);

QuickPdfNativeMethods.SelectFont(fontId);
QuickPdfNativeMethods.SetTextSize(12);
QuickPdfNativeMethods.DrawText(10, 10, "Hello World:");
sPdf = QuickPdfNativeMethods.SaveToString();
// throw Exception
QuickPdfNativeMethods.RemoveDocument(docId);



whenever ->
a TrueType Font was added, but not embedded. (AddTrueTypeFont(fontName, 0))
Exception is throws after min. 2 invokes of SaveToString()

Using ->
an embeded TTF. (AddTrueTypeFont(fontName, 1))
Exception is throws after min. 8 invokes of SaveToString()

Using ->
a standard font, the SaveToString() still works fine!

Seems to be a bug?
Any good advices or workarounds
except using standard fonts???

Best regards,
Torsten




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk