|
Rank: Newbie Groups: Member
Joined: 5/22/2016 Posts: 6
|
Hi,
Can I create a unit test that check if my code that create the PDF report didn't broke? I would like to create a "good" pdf report that I created using the EO component that I manually verified him. And create in the scenario the same PDF - from the same HTML files and compare both PDF
I tried to do so, but found out the the binary is different.
Is there a way to verify that two PDF generated from the same input or visually the same? without 3rd party software for visual compare?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, It is not possible to compare PDF files directly with our product. What you can do is to set HtmlToPdf.Options.GeneratePageImages to true and then compare the similarity of the page images. Comparing images is a common task for test automation. MS has one implementation here: https://msdn.microsoft.com/en-us/library/hh157587.aspxYou can also find a number of other implementation online. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/22/2016 Posts: 6
|
Hi, Thanks for the quick reply.
I tried using the "HtmlToPdf.Options.GeneratePageImages" and did managed to get PNG's and compare them. But...
I noticed that the PNG's are different from the final PDF page. For example, I adding header and footer for each page before I export the Images using:
AcmRender render = new AcmRender(page, 0, new AcmPageLayout(new AcmPadding(0.5f, 0, 0.5f, 0))); render.Render(headerTable, footerTable);
I do get the footer and header in the PDF file but the Images are exported without it.
Is it a defect? Is there an options the export to PNG the final PDF pages?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Whatever you added after the conversion will not be reflected through the page images. The page images is an output of the HTML to PDF converter, what you rendered through AcmRender is completely separate so it won't go into page images. Currently there is no way to render the final PDF as images with our product, even though we may add this feature in the future.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/22/2016 Posts: 6
|
OK, Got it,
I'll post this request in the feature request tab. This ability is highly important for us.
Thanks
|
|