MaxMelcher / AzureDevOps.WikiPDFExport

Export Azure DevOps Wiki to PDF
MIT License
187 stars 62 forks source link

Footer rendered differently in v3 #66

Closed Jheronymus closed 3 years ago

Jheronymus commented 3 years ago

Hi, I just noticed that the footer is rendered differently when moving from version 2.9.0 to 3.0.0

Version V2.9.0 image

Version V3.0.0 image

Those screenshots were from Acrobat, in the Edge browser the footer looks even worse: image

I think the inline styling is ignored. Or the stylesheet is now applied later and also to the header and footer I could not find any logging on the header/footer generation using the -v and --debug options.

I'm using the (undocumented) --header-url and --footer-url to link to the files

full command & ".\azuredevops-export-wiki.exe" -v -o export.pdf --debug --css .\devopswikistyle.css --header-url .\page-header.html --footer-url .\page-footer.html -b -m

Code:

<!DOCTYPE html>
<html>

<head>
    <script>
        function subst() {
            var vars = {};
            var query_strings_from_url = document.location.search.substring(1).split('&');
            for (var query_string in query_strings_from_url) {
                if (query_strings_from_url.hasOwnProperty(query_string)) {
                    var temp_var = query_strings_from_url[query_string].split('=', 2);
                    vars[temp_var[0]] = decodeURI(temp_var[1]);
                }
            }
            var css_selector_classes = ['page', 'frompage', 'topage', 'webpage', 'section', 'subsection', 'date', 'isodate', 'time', 'title', 'doctitle', 'sitepage', 'sitepages'];
            for (var css_class in css_selector_classes) {
                if (css_selector_classes.hasOwnProperty(css_class)) {
                    var element = document.getElementsByClassName(css_selector_classes[css_class]);
                    for (var j = 0; j < element.length; ++j) {
                        element[j].textContent = vars[css_selector_classes[css_class]];
                    }
                }
            }
        }
    </script>
</head>

<body style="border:0; margin: 0;" onload="subst()">
    <table style="width: 100%">
        <tr><td style="text-align:left; font-size: small">Document generated on: <span class="date"></span></td>
            <td style="text-align:right">
                Page <span class="page"></span> of <span class="topage"></span>
            </td>
        </tr>
    </table>
</body>

</html>
MaxMelcher commented 3 years ago

Most likely a css thing - the footer has not changed. Are you using the same parameters for both converters?

Jheronymus commented 3 years ago

Yes, I specifically downloaded v2.9.0 to retest and verify the results. I'll test tomorrow if the stylesheet is now global to the document, which I thought it wasn't (hence the online styling). If it is, that's actually an improvement.

MaxMelcher commented 3 years ago

Not sure, let me know what you find out

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jeroen @.> Sent: Thursday, June 3, 2021 11:29:26 PM To: MaxMelcher/AzureDevOps.WikiPDFExport @.> Cc: Max Melcher @.>; Comment @.> Subject: Re: [MaxMelcher/AzureDevOps.WikiPDFExport] Footer rendered differently in v3 (#66)

Yes, I specifically downloaded v2.9.0 to retest and verify the results. I'll test tomorrow if the stylesheet is now global to the document, which I thought it wasn't (hence the online styling). If it is, that's actually an improvement.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/MaxMelcher/AzureDevOps.WikiPDFExport/issues/66#issuecomment-854193006, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAH3LNZ5LGT5HUIVQIWP5L3TQ7X3NANCNFSM46A5ERTQ.

Jheronymus commented 3 years ago

Just tested this by adding a class to my header/footer and put the styling (font color) for this class in the css file that gets passed in. The result is as I expected:

This concludes that the passed in stylesheet is now global to the whole document. I would consider this a feature, not a bug. But maybe good to mention this and/or update the example header/footer files.

MaxMelcher commented 3 years ago

Thats nice - let's update the docs and css then

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jeroen @.> Sent: Friday, June 4, 2021 11:52:47 AM To: MaxMelcher/AzureDevOps.WikiPDFExport @.> Cc: Max Melcher @.>; Comment @.> Subject: Re: [MaxMelcher/AzureDevOps.WikiPDFExport] Footer rendered differently in v3 (#66)

Just tested this by adding a class to my header/footer and put the styling (font color) for this class in the css file that gets passed in. The result is as I expected:

This concludes that the passed in stylesheet is now global to the whole document. I would consider this a feature, not a bug. But maybe good to mention this and/or update the example header/footer files.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/MaxMelcher/AzureDevOps.WikiPDFExport/issues/66#issuecomment-854543184, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAH3LN7E4IW5VAIKEFBCMZTTRCO67ANCNFSM46A5ERTQ.

Jheronymus commented 3 years ago

I fixed my own document now. The only thing I can't seem to figure out is why all table cells have 0 padding. (this is throughout the document. The v2.9.0 html output had the stylesheet in the header. The v3.0.0 just has bare HTML. If you add the style sheet, the browser shows the tables with some padding, but this is not reflected in the PDF.

MaxMelcher commented 3 years ago

I tried to make the example a little bit better and document the parameters that were missing. The header and footer html is really tricky.

header: image

footer: image

The inherit the css, otherwise the icons would not work there.

MaxMelcher commented 3 years ago

can we close this?

Jheronymus commented 3 years ago

yeah, I think so. I still have some issues with the layouting, but will try with the newer version and extended logging.