Fix for issues #67 and #35 #68

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

xk commented Mar 31, 2012

The PDF 1.3 Reference Manual says (4.3 numbers, page 37):
Exponential format for numbers (such as 1.0E3) is not supported.

@xk xk fix for issues #67 and #35
The PDF 1.3 Reference Manual says (4.3 numbers, page 37):
Exponential format for numbers (such as 1.0E3) is not supported.
dfc37fe

@devongovett devongovett added a commit that referenced this pull request Apr 4, 2012

@devongovett devongovett Fix transformation issues. Closes #67, #68 and #35.
I think 5 decimal places is probably enough.
2e457ac

devongovett closed this Apr 4, 2012

Owner

devongovett commented Apr 4, 2012

Thanks for looking to this. I implemented something similar in 2e457ac. I think 5 decimal places is probably enough. :)

xk commented Apr 4, 2012

Hi Devon, I'm glad to contribute to this awesome module.

You patch is shorter, yes, but it adds to 0 and any integer a ~useless .00000 , mine takes care to do that only for numbers < 1 and > -1, and to print zeros as 0 not as 0.00000 ... :-)

Also, note that it's not only transform who writes reals, this conversion from exponential to fixed should be done anywhere a real is written to the .pdf.

Owner

devongovett commented Apr 4, 2012

Ah but mine does as well! That's what the + is for in +v.toFixed(5). First it generates a string rounded to 5 decimal places and including extra 0s but the + converts it back to a number, which discards the extra 0s. Try it: (0).toFixed(5) evaluates to "0.00000" but +(0).toFixed(5) evaluates to just 0.

As for the rest of the PDF, I don't think there is anywhere else that exponential notation would reasonably be used so just doing this for transforms seems fine to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment