PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 7:39 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Mar 21, 2019 8:00 pm 
Offline

Joined: Thu Mar 21, 2019 7:53 pm
Posts: 1
Found and fixed an issue when a real number is a very large whole number.

What was happening is that value (which was imported from a separate PDF) was being written as an integer when saved (i.e. no decimal point added), causing an overflow both in PdfSharp and Acrobat Reader when the file was opened.

In PdfWriter.cs, about line 169:
Code:
/// <summary>
/// Writes the specified value to the PDF stream.
/// </summary>
public void Write(PdfReal value)
{
            WriteSeparator(CharCat.Character);
            WriteRaw(value.Value.ToString("0.0#######", CultureInfo.InvariantCulture));
            // ORIGINAL WriteRaw(value.Value.ToString(Config.SignificantFigures7, CultureInfo.InvariantCulture));
            _lastCat = CharCat.Character;
}


The above forces a ".0" after the integral value. Probably a more elegant way to do it (don't necessarily need the zero, for example), but for what it's worth.

Cheers,
Nathan Brady


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 44 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group