Forum Bugs

Negative value for margin-top causing error

dgcarlson
We convert client html files into PDF's and have found an issue when using a style that has a negative value for margin-top. Attached are the files. Basically the issue is that the text following the negative margin-top is all run together with no spaces. The text that is affected is not part of the element that contains the negative value. The text as in the converted pdf:

Everythinginthisparagraphgetsmessedupandsquishedtogetherwithnospaces.

We cannot change the data files, as they are client data.
  1. myHtml.htm0.6 kB
    HTML file
  2. myStylesheet.css0.2 kB
    Stylesheet
dgcarlson
I have come across some more examples that are similar, if you would like more test cases.
mikeday
I can't seem to reproduce this issue; which version of Prince are you running, and on which operating system? Can you generate the PDF file with --no-compress on the command-line and post it here?
dgcarlson
I appologize. There are other settings in our css files, and I created this test case without all of the files. I added the relevant items to this new css file. Basically, if text-align is set to justify then we have a problem. Attached is the css file, and a pdf file created with the prince gui. I am using a version of prince that you sent me in response to this issue:
http://www.princexml.com/forum/topic/2274/transform-matrix-not-working-correctly

Thanks!
  1. myHtml.pdf31.0 kB
  2. myStylesheet.css0.4 kB
dgcarlson

C:\Program Files (x86)\Prince\Engine\bin>prince --version
Prince 8.1 2013-03-26
Copyright 2002-2013 YesLogic Pty. Ltd.
Server License

C:\Program Files (x86)\Prince\Engine\bin>
mikeday
Thanks, I can reproduce the issue now; we will investigate.
dgcarlson
If you would like, I can send real-world examples as well. I would have to email them, as the data is copyright protected. It looks like there are also issues with lining up subsequent elements as well.
mikeday
Sure, if you could email me (mikeday@yeslogic.com) that would be great. We think we have resolved this issue now, but it would be good to confirm there are no remaining problems, then we can release the fix with Prince 9.0.
dgcarlson
Hello, I received your updated exe this morning. This has fixed several scenarios, but I still have a couple that are not fixed. I have attached these scenarios. Thanks
  1. NegativeMargin1.html0.6 kB
  2. NegativeMargin1.pdf17.1 kB
  3. NegativeMargin2.css12.0 kB
  4. NegativeMargin2.htm0.5 kB
  5. NegativeMargin2.pdf27.0 kB
  6. negativeValue1.css9.4 kB
dgcarlson
I forgot to attach this one
  1. NegativeMargin3.css13.7 kB
  2. NegativeMargin3.htm0.6 kB
  3. NegativeMargin3.pdf26.7 kB
dgcarlson
Here is another example that just came back from production
  1. NegativeMargin4.css13.5 kB
  2. NegativeMargin4.htm0.5 kB
  3. NegativeMargin4.pdf16.1 kB
mikeday
Thanks, we will take a look at these.
mikeday
I can't find any problem with NegativeMargin3, it looks the same as in the browser. However, there are numerous syntax errors in the CSS, such as mismatched braces { }, spaces between numbers and units (eg. "2 em") and missing zeroes in numbers (eg. "-.4" should be "-0.4") and this may complicate things.
dgcarlson
NegativeMargin3 and NegativeMargin4 may be invalid, as I am creating them from client data, and stripped out as much as I could.

I seem to be having another problem with the new exe you sent. I keep getting this error:
GC Warning: Out of Memory! Heap size: 1888 MiB. Returning NULL!

My machine stats: Xeon X5650 dual core @2.67GHz, 2.66 GHz
RAM: 18GB
Windows 7 64 bit

All documents are being converted from html files with all images and resources local to the file. The old version does not give this error. Any ideas?
mikeday
Can you pass "-i html4" on the command-line? It may be an issue with the new HTML5 parser.

Regarding the negative margin issue, all the test cases seem similar in Prince and the web browser, so I'm having trouble seeing any problem at this point.
dgcarlson
I agree on my test data, they look the same. I apologize for that. These are 'scenarios' that I stripped out of production data. I will try to get approval to send the actual data to you. Thank you for your time, and patience in looking into this. Again, I apologize for my test data.

I will try with the "-i html4" option.
mikeday
No worries, coming up with test documents for these subtle issues can be very tricky! :)

Regarding the memory usage, we've seen on another thread that --javascript can cause increased memory consumption, even when the document does not contain scripts.
dgcarlson
Hmm... we are calling Prince.convert(List<String> xmlPath, String pdfPath, File workingDir), and when I stop and look at the command line that is sent to Util.invokeProcess it looks like:

target/prince/Engine/bin/prince.exe,
--verbose,
--style=C:\Users\dcarlson\AppData\Local\Temp\test4480013797762720505temp.css,
--style=C:\Users\dcarlson\AppData\Local\Temp\3523304476513377611.tmp\OEBPS\hpStyle.css,
--input=html,
--log=G:\projects\EpubConverterService\target\classes\..\log\prince.log,
--server,
Text/Half-Title.xhtml,
C:\Users\dcarlson\AppData\Local\Temp\junit379722917826233582\9781459705791.pdf

I don't see --javascript,
mikeday
Right, in that case JavaScript won't be a problem. Can you try calling Prince.setInputType("html4")?
dgcarlson
Yes, I tried that before. I just did it again and my command line looks like:
target/prince/Engine/bin/prince.exe,
--verbose,
--style=C:\Users\dcarlson\AppData\Local\Temp\test3803216341495130268temp.css,
--style=C:\Users\dcarlson\AppData\Local\Temp\6436150593822725929.tmp\OEBPS\hpStyle.css,
--input=html4,
--log=G:\projects\EpubConverterService\target\classes\prince.log,
--server,
Text/Half-Title.xhtml,
C:\Users\dcarlson\AppData\Local\Temp\junit7071572454744373962\9781459705791.pdf


Attached is a copy of my actual prince.log
  1. prince.log16.6 kB
mikeday
Hmm, so it's not the HTML parser or JavaScript DOM, and it used to work in the past, but now runs out of memory and fails. Are you able to send me a document that we can use to reproduce the problem?
dgcarlson
I will email you a zip with the files in it, as well as my command line.
dgcarlson
Email sent.
mikeday
The unexpectedly high memory usage seems to be caused by a cyclic font definition:
@font-face {
font-family: "Calibri";
font-style: normal;
font-weight: normal;
src:local(Calibri);
}

Prince should ignore this, so we're still investigating what's gone wrong.
mikeday
We will change Prince to issue a warning for this situation and ignore the rule, this solves the problem. In the meantime, remove this rule from the style sheet will fix the issue.
mikeday
Prince 9 is now available, and issues a warning for cyclic @font-face rules and eliminates the slowdown and high memory usage they used to cause. It also includes a fix for the layout corruption that was caused by negative margin-top in certain circumstances. Thank you again for your patience and assistance with these issues. :)
dgcarlson
I downloaded version 9 in order to test and close out my internal bug reports related to these issues, and I get an error that my license file is invalid. How do I fix this?
mikeday
You may need to upgrade by purchasing a support contract.