|
Rank: Newbie Groups: Member
Joined: 10/6/2016 Posts: 5
|
We recently upgraded from version 4.0.60.2 to 16.2.23.0. We are experience 2 issues.
1) Using ScaleToFit on AutoFitX. Several documents which used to center correctly and take a single page now push onto 2 pages and appear zoomed and not centered. If I change the setting to None or ShrinkToFit it works correctly.
2) When using a repeating background we got very odd behavior. Specifically we have this div:
<div style='height:6px;width:96%;background-image:url(https://enroll.brightwood.edu/Assets/images/shoppingsheet/dot.gif); background-repeat:repeat-x;margin-top:1px;float:left'> </div>
It ends up rending dots are not even and have shadow lines.
I have the HTML and the resulting PDF and can email both if there is an address to send them to.
Thanks,
Byron
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, Please email the files to us and we will be happy to take a look. You can find our email address here: https://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
We have looked into the test project you sent to us. Here are our findings:
Issue #1 is an issue on our side and will be fixed in our next build. We will reply again when this issue is fixed. Issue #2 seems to be an issue in Chromium's browser engine. We would recommend you to try to avoid repeating by using a big background image.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
This is just to let you know that we have posted a new build that should fix the first issue. You can download the new build from our download page. Please take a look and let us know how it goes.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/6/2016 Posts: 5
|
I got the updated library and implemented it. The ScaleToFit issue is now resolved. The other document that we convert to PDF is an HTML document provided by the Department of Education. There is an overview here: http://www2.ed.gov/policy/highered/guid/aid-offer/index.html The actual shopping sheet html and all the images are located here in a downloadable zip file: https://ifap.ed.gov/eannouncements/011916FinancialAidShoppingSheet20162017.htmlWhile it is possible to modify the HTML to make it work correctly, I can't do that because the document is provided to our school by the DOE and should not be changed. We needed to upgrade EO.PDF to the latest version in order for it to work with Windows 10. The previous version we were using (4.0.60.2) could render this document correctly. Per you note the issue is in the Chromium browser, but chrome is able to view the HTML correctly. Is EO.PDF using a different version of the Chromium engine than the Chrome browser is? Why would it work correctly in 4.0.60.2 and not in the current version?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
I am not exactly sure if I understand your question. The page you posted seems to convert fine. Can you describe which part in the result PDF file is not correct so that we can check again?
There can be some subtle differences between the new version and the old version due to a number of reasons. The most important reason is the new version uses a much newer browser engine. Also the new engine does not consider margin/padding on the document element while the old version does. This generally means the new version has a less margin thus fits more contents per page than the old version.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/6/2016 Posts: 5
|
I sent a zip file with the results of the conversion on my end on 10/10 to support. I can re-send if you need it.
Basically the issue is the repeating background of a image of a dot does not convert to PDF correctly. It looks fine in the browser, but in the PDF it has odd shadows and repeats. The layout and margins are all fine, it just does not convert the repeating background correctly.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, We are aware of this issue and we have not been able to fix this in the current release cycle due to the fact that the problem appears to be rooted inside the browser engine. Hopefully when we sync to Chromium's code base again this issue will be resolved. In the mean time you can to override certain resources in your HTML page to avoid this issue. The code will be something like this:
Code: C#
//This is a custom resource handler that fails on the background
//image Url on purpose so that it won't be rendered
private class CustomResourceHandler : EO.WebBrowser.ResourceHandler
{
public override bool Match(Request request)
{
return request.Url == your_background_image_url;
}
public override void ProcessRequest(Request request, Response response)
{
//Fails on purpose so that it won't be rendered. Alternatively, you can
//render a replace image here
throw new NotImplementedException();
}
}
//You must use a HtmlToPdfSession object since we need
//the RunWebViewCallback method offered by this class
using (HtmlToPdfSession session = HtmlToPdfSession.Create())
{
//Register the CustomResourceHandler with the underlying
//WebView object that is responsible to render the page
CustomResourceHandler handler = new CustomResourceHandler();
session.RunWebViewCallback((webView, arg) =>
{
webView.RegisterResourceHandler(handler);
return null;
}, null);
//Load the Url into the WebView
session.LoadUrl(html_file_name);
//Render it as PDF
session.RenderAsPDF(pdf_file_name);
//Unregister the custom handler
session.RunWebViewCallback((webView, arg) =>
{
webView.UnregisterResourceHandler(handler);
return null;
}, null);
}
The above code uses a CustomResource handler to fail the background image request on purpose so that it won't be rendered at all. However the key is you can do anything the underlying WebView supports inside RunWebViewCallback. For example, you can call WebView.EvalScript to dynamically modify the page before rendering it to PDF. Hope this helps. Please feel free to let us know if you have any questions. Thanks!
|
|