To render the resulting PDF you will need to use the new Debenu Renderer in Debenu PDF Library 10.xx versions. Refer to the README.TXT in the "Rendering and Printing Add-On" folder in the DQPL installation directory.
int ret = QP.LoadFromFile("Debenu Quick PDF Library 10.15 Reference Guide.pdf", "");
int imgId = QP.AddImageFromFile("DebenuLogo.bmp", 0);
int fontId = QP.AddStandardFont(4);
double angle = 30;
for (int i = 1; i <= QP.PageCount(); i++) // Start at page 1.
{
QP.SelectPage(i);
QP.NormalizePage(0); // Fix any page problems and remove rotation
QP.SetOrigin(1);
int csId = QP.NewContentStream(); // Create a new layer at the top that is drawn last.
QP.SelectContentStream(csId); // Select the content stream
QP.SaveState(); // Save the graphics state.
QP.SetTransparency(90);
// Now draw something into the content stream.
if (i % 2 == 0)
{
QP.SelectImage(imgId);
QP.DrawImage(0, 0, QP.PageWidth(), QP.PageHeight());
}
else // Draw text
{
QP.SelectFont(fontId);
QP.SetTextAlign(1); // Align text center
QP.SetTextSize(72);
QP.SetTextColor(0, 0, 0);
QP.DrawRotatedText(QP.PageWidth() / 2 + 3, QP.PageHeight() / 2 + 3, angle, "www.debenu.com"); // Draw Watermark at center
QP.SetTextColor(0, 0, 1);
QP.DrawRotatedText(QP.PageWidth() / 2, QP.PageHeight() / 2, angle, "www.debenu.com"); // Draw Watermark at center
double tx = QP.GetTextWidth("www.debenu.com") / 2 * Math.Cos(angle * Math.PI / 180);
double ty = QP.GetTextWidth("www.debenu.com") / 2 * Math.Sin(angle * Math.PI / 180);
double x, y, w, h;
double hx = QP.GetTextAscent() * Math.Sin(angle * Math.PI / 180);
double hy = QP.GetTextAscent() * Math.Cos(angle * Math.PI / 180);
x = QP.PageWidth() / 2 - tx - hx;
y = QP.PageHeight() / 2 - ty - hy;
w = tx * 2 + hx;
h = ty * 2 + hy;
QP.AddLinkToWeb(x, y, w, h, "http://www.debenu.com", 0);
QP.SetTextSize(132);
QP.SetTextColor(1, 0, 0);
QP.DrawRotatedText(QP.PageWidth() / 2, QP.PageHeight() / 2 - 80, angle, "DEMO"); // Draw Watermark at center
}
QP.LoadState(); // Restore the graphics state
QP.MoveContentStream(csId, 1); // Move the new layer/contentstream to bottom so it is drawn first.
}
QP.SaveToFile("out.pdf");