I upgraded from v10 to v11 and reran a test page that places a BackgroundImage on a Template. The image happens to be a full letter sized graphic to put corporate branding on the page in the right places at the top and bottom of the page. So one graphic, letter sized . Using the same test .aspx page using v10, the PDF page is correctly rendered with that background graphic; branding assets are flush to the bottom of the page and a logo is nicely rendered in the top right of the page where it's supposed to be.
That same test .aspx page does not render the same, however, when using v11. Instead the BackgroundImage appears to be constrained to the inside of the page margins set for the text.
(If there is a way to upload images or pdf samples to attach to this post, please let me know and I can provide visual examples.)
The code is quite simple (and, again, has not changed, only the version of the DynamicPDF.NETFramework40.dll available to the web page):
.
.
.
Template template = new Template();
string path = "assume a full path to our corporate image here.png";
ImageData imageData = ImageData.GetImage(path);
BackgroundImage img = new BackgroundImage(imageData);
template.Elements.Add(img);
.
.
.
BackgroundImage is not placed the same as v10
Re: BackgroundImage is not placed the same as v10
Support · Jan 29, 2021Hi,
We did some testing on our end and are unable to recreate the behavior. Below is a code sample used for testing.
Document document = new Document();
Page page = new Page();
document.Pages.Add(page);
Template template = new Template();
string path = @"Source image file path";
ImageData imageData = ImageData.GetImage(path);
BackgroundImage img = new BackgroundImage(imageData);
template.Elements.Add(img);
document.Template = template;
string output = @"Output PDF file path";
document.Draw(output);
If you continue facing problems, please send over the following information to [^a|mailto:support@dynamicpdf.com|opennewwindow|support@dynamicpdf.com^] so we can look into it further.
1. Modify the above code sample accordingly to recreate the behavior.
2. Source image.
3. Output PDF (created with v10 and v11).
4. Exact version and build number of the DynamicPDF DLL file used in your application. You can get this information in DLL references properties (Version and Description fields) in Visual Studio OR right click on the DLL file>Properties>>Details tab>>Product version, take a screenshot of Details tab showing all info and send it over to us.
Thanks,
ceTe Software Support Team
Re: BackgroundImage is not placed the same as v10
Forum member · Jan 29, 2021I was doing some more testing and noticed the UseMargins property on the BackgroundImage object. As you'll note in the code originally posted, this was not explicitly set. But when I set it to false
BackgroundImage img = new BackgroundImage(path);
img.UseMargins = false;
then the page renders as it did before. So, I'm assuming the "default" value for this changed.
Re: BackgroundImage is not placed the same as v10
Support · Jan 29, 2021Hi,
Yes, we are able to recreate it now. It looks like that default value did change. We will look into this further evaluate changing the default to false for the BackgroundImage page element. We'll follow-up in a few days. In the meantime, setting it to false is a good workaround.
Thanks,
ceTe Software Support Team
Re: BackgroundImage is not placed the same as v10
Support · Feb 8, 2021Hi,
We released an update a few days ago that corrects this issue, DynamicPDF Core Suite for .NET (v11.06). You can download latest version from NuGet (Package ID: ceTe.DynamicPDF.CoreSuite.NET) or from our website here
.
Thanks,
ceTe Software Support Team