Watermark (Watermark) on ASP.NET MVC PDF rotary

Asked

Viewed 964 times

2

Hello, I’m having trouble adding a watermark in a report generated with rotary pdf.

This report has a header, which repeats on all pages and a footer that also repeats on all pages, now I want to make it have a background watermark on all pages, the results I’ve gotten so far was:

1) the mark on top of the printed data, repeating on all pages I tried to use position relative, Absolute and Fixed, with z-index, but it did not work as I would like, part of the report was branded Behind(below) and another part was (In Front).

2) the mark below the data repeating on all pages as the result you would like, but only on the first page, on the second page the mark was printed further to the left of the report repeating part of the image on the right side.

.water_mark {
    background-image: url(../Images/marca-dagua.png);
    background-repeat: repeat-y;
    padding-right:5px; background-size: 80% auto;
}
 <div class="col-xs-12 no-padding-left water_mark" style="">
        <table class="table table-bordered">
    </table>
    </div>
.water_mark {
    background-image: url(../Images/marca-dagua.png);
    background-repeat: repeat-y;
    padding-right:5px; background-size: 80% auto;
    background-position-x: 100px;
}

this is the result code 2.

.water_mark {
    background-image: url(../Images/marca-dagua.png);
    width: 100%;
  height: 1500px; /* TAMANHO DA FOLHA */
  Position: absolute;
  z-index: -1; /* TENTEI OUTROS Z-INDEX */  
}
<div class="water_mark" style="">
</div>
   <table class="table table-bordered">
     </table>

result code 1.

I believe I have a way to pass to the Rotary PDF a background image, but so far I could not get the result, for this reason I tried to solve with css.

Note: the header and footer are made with the rotary through the property: Customswitches as code below.

string customSwitches = "--footer-left \"Versão: " + Versao.NumeroVersao + "\" " +
                    "--footer-center \"Chave de segurança: " + ChaveSeguranca + "\" " +
                    "--footer-right \"Página: [page] de [toPage]\"" +
                    " --footer-line --footer-font-size \"7\" " +
                    " --footer-spacing 5 " +
                    "--header-html  \"" + Url.Action("Header", "PadraoRelatorio", new { area = "", Titulo = "PARA CONSTRUÇÃO" }, "http") + "\" " +
                    "--header-spacing \"5\" " +
                    "--header-font-size \"7\"";
  • 1

    The Rotary is very limited to do what you want. I recommend starting for the Pdfsharp or the iTextSharp.

  • Gypsy, thank you for your reply, I understand that Rotary is really limited, I will be making the migration to another report in the future (possibly to iTextSharp), but at the precise moment to give a quick response to the customer, this watermark case was an addition of requirements, and unfortunately we can’t predict this, so I have an extremely short deadline.

  • Tell them you can’t do it fast. See: Rotary converts HTML into watermark. HTML is no longer something that has "watermark", so you have to format the PDF in hand.

  • 1

    Thanks for the answer, I’m redoing the report with iTextSharp. Are the tools of Telerik and Xtrareport(devexpress), good? has worked with any?

  • 1

    No, I don’t pay for any components I use in my applications.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.