Hello, I've got a problem creating a PDF with certain heights in the PdfPageSetting:
Setting an height between 215 and 236, when I try to load the generated PDF in the viewer, an exception is raised:
System.Collections.Generic.KeyNotFoudException {"The given key was not present in the dictionary."}
Using any other heights it works like a charm.
Unfortunately I need exactly that height because I've got labels of 80mm * [mm2Inch conversion factor] * [72dpi] = 226!!
Below you can find the code snippet.
Any suggestion? I need this component to work as soon as possible!
Thak you
Luca Cavicchioli
var document = new PdfDocument
{
//PageSettings = new PdfPageSettings(new SizeF(docWidth, docHeight), 0f)
PageSettings = new PdfPageSettings(new SizeF(283, 226), 0f) // <= HERE IS THE PROBLEM
};
//Add a new page to the document.
PdfPage page = document.Pages.Add();
//Create Pdf graphics surface for the page
PdfGraphics pdfSurface = page.Graphics;
// --- Drawing something on the surface... but not necessary to reproduce the bug exposed ---
//var drawer = new Drawer.Drawer(true);
//drawer.DrawCanvas(_etichetta, pdfSurface);
Stream pdfStream = new MemoryStream();
document.Save(pdfStream);
document.Close(true);
var doc = new PdfLoadedDocument(pdfStream);
pdfViewerControl.Load(doc); // <= HERE WHERE THE ERROR IS RAISED