Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Footer issue and documentation on using 'default params' #65

Open
stumiller opened this issue Feb 22, 2022 · 1 comment
Open

Footer issue and documentation on using 'default params' #65

stumiller opened this issue Feb 22, 2022 · 1 comment

Comments

@stumiller
Copy link

Originally added to:
fpanaccia/Wkhtmltopdf.NetCore.Example-deprecated#22

I have some legal documents that I'm having to recreate in PDF from a .Net 5 (core) MVC application (using wkhtmltopdf.netcore 3.0.2). Obviously, I'm using your tool and for the most part, it's worked great. However, when it comes to footers, my legal docs have special conditions for footers. Like some pages not having paging and others resetting the starting page when a new section is encounters. With that being said, how do you use the "url" and special parameters that you've given us? How does using the "section" parameter work? I can't get it too. Section is always blank.

https://localhost:44342/footer.html?
page=1&section=&sitepage=1&title=&subsection=&username=Veaer&url=google.com&frompage=1&subsubsection=&age=20&isodate=2022-02-
14&topage=20&doctitle=&sitepages=20&webpage=-&time=3:10:34%20PM&date=2/14/2022

I'm behind on a project due to this footer issue and we might have to bail on using this tool. Any help would be awesome!
Thanks

Update....
One thing I just noticed and I technically fixed in my original comment is the url. The "section" part of the url is coming out wrong. I'm just using your original code and pulling it out.

var url = window.location.href.replace(/#$/, ""); // Remove last # if exist
document.getElementById("url").innerHTML = url;

https://localhost:44342/footer.html?
page=2§ion=&sitepage=2&title=&subsection=&username=Veaer&url=google.com&frompage=1&subsubsection=&age=20&isodate=2022-02-
14&topage=20&doctitle=&sitepages=20&webpage=-&time=3:24:23%20PM&date=2/14/2022

Thanks

@Jefferycheng
Copy link

I am trying to understand your question.
You mean you have set the parameters [section] [subsection] [subsubsection], but there are not appear on the pdf, right?

If this is your question.
You need to add parameters in footer.html like the following code example.

footer.html

<body onload="replaceParams()">
    name: {username}
    age: {age}
    url: {url}
    page {page}

    Section : {section}
    Subsection : {subsection}
    Subsubsection : {subsubsection}
</body>

Alternatively, you can write your footer script by yourself.
Not through the footer API get the footer information.

You could reference my article to understand how to set the header or footer not through the API but through your script.

https://medium.com/@lovemath288772/how-to-add-page-number-header-footer-with-wkhtmltopdf-in-dotnet-e0f2531118c0

Hope can help you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants