albrechtf / mcf2pdf

"My CEWE Photobook" MCF to PDF converter
Other
41 stars 36 forks source link

Fixed spine, other improvements #37

Open cdce8p opened 6 years ago

cdce8p commented 6 years ago

Should also fix: #15

Note: the bundlesize attribute might not be backwarts compatible! I coun`t check that.

albrechtf commented 6 years ago

Thanks for your contribution! Before I start a full review, might you please explain the basic concepts of your change? Especially why you changed units in many classes from millimeters to pixels, and why the renaming of setBundlesize to addBundlesize was necessary. Thanks!

cdce8p commented 6 years ago

My original intent was to fix the missing spine. I discovered that it's still possible to go your original route via spineWidth and normalPages if you get those parameter from the pricelist. Since this would have meant dealing with one more file I found an alternative in the bundlesize/width and bundlesize/height attributes. Regarding your question: I'm not quite sure why I choose addBundlesize instead of setBundlesize. In the next commit I will change that.

After that was done I noticed a slim white bar at the top of each page. My original idea was that at some point during the conversion the float values could be an issue. It turned out it wasn't the case. Neverthenless could working with ints instead of floast provide some benifits (see PageBackground) and since I already did most of the work their, I decided to follow through with it.

Regarding the withe bar at the top: While debugging I found a workaround. If you set bc.setAttribute("top", "-1px") the white bar disapears at the top, but sadly comes back at the bottom. Later I discovered that during the conversion an image is created which is subsequently placed in the block element. Since I know that the issue must be with the block-container element I tried the background-image parameter which worked. I still haven't figured out why it didn't work before though. This has the added benifit of reducing the overall size of the XML-FO. Out of curiosity I checked if other parameter aren't neccessary. It turned out that especially docBuilder.newPage() wasn't which reduces the overall size and speeds up the conversion quite a bit.

Hope that helps.