We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Problem with PDF height

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();
var doc = new PdfLoadedDocument(pdfStream);
pdfViewerControl.Load(doc); // <= HERE WHERE THE ERROR IS RAISED

1 Reply

US Uthistran S Syncfusion Team July 8, 2014 09:50 AM UTC

Hi Luca,

Thank you for your update.

We have tried your code snippet in a simple sample in our Latest Essential Studio version ( and we are unable to reproduce the exception.

Attached the sample for your reference.

Attachment: PdfViewerSample.zip

Could you please, provide us the detail of the Essential studio version installed in your machine? That would help us for further investigation. Else, modify the attached sample to reproduce the issue in our side.

Please, let us know if you need any further assistance.


Uthistran S.

Live Chat Icon For mobile
Up arrow icon