I am trying to convert one of our front-end pages into a PDF (page built specifically for that and can be modified if needed). I found the following doc describing how to do this with Syncfusion: url-to-pdf. However, when I try to do this for our page I get error "Target container is not a DOM element" for any id except for root.
Here is the structure of our page: (see pic html.png from attached zip)
Here I am tried to convert page elements with id "PDF-content", "PDF-report-header" and other deeper embedded elements, but keep on getting the same error as I mentioned above.
Web page itself is written in React. "root" is the top most element containing component App. App component defines different page content through router paths, including path to page in question: (see pic react-page.png from attached zip)
My guess is that for some reason html converter cannot see the elements "below" root at the time of the request to convert but none of elements I tried to convert have any JS in ID name or way it renders. I have added delay to wait for page to render before converting, but that didn't help either.
Here is part of the code of .NET API that is supposed to return rendered PDF: (see pic net-code.png from attached zip)
Can you please help me to figure out what I am doing wrong here?
Thanks!
We were able to reproduce the reported issue with provided details on our end. Currently, we are validating on this and will update the further details on june 8th 2023.
Currently, we are working on this. We will update further details on June 12, 2023.
We are facing complexities on this, due to the element root being missing after getting the element 'PDF-content' details alone in partial conversion which causes the issue in ReactDom.render process and prints the exception in the output document. Currently, we are working on this and we will update further details on June 14th,2023.
We have confirmed that the reported issues “Partial URL to PDF does not work with React page in HTML to PDF conversion” as a defect in our product and we will include the fix in our upcoming weekly NuGet release, which will be available on June 27th, 2023.
Please find the feedback link below to track the status,
We regret the inconvenience caused.
Due to technical issues in our side, we are unable to include the fix for the reported issue in this weekly release. We will include the fix into our upcoming weekly NuGet release without any delay which will be available on July 4th , 2023.
Please use the below feedback link to track the status of the reported bug.
https://www.syncfusion.com/feedback/44476/partial-url-to-pdf-does-not-work-with-react-page-in-html-to-pdf-conversion
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
No worries, bugs can be tricky ;-)
We have included the fix for this issue “Partial URL to PDF does not work with React page in HTML to PDF conversion" fix in our latest weekly release (22.1.37).
Please use the below link to download our latest NuGet,
Nuget Link: https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Windows/22.1.37