Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

Is there a way to use a background color other than white when rendering a PDF?

Question

I'm looking at Quick PDF and I'm interested to know if there a way to use a background color other than white when rendering a PDF?

Answer

The background color can be whatever you want it to be. Using the SetFillColor and DrawBox functions, you can draw a new background onto your PDF files with whatever color you like.

Here is some basic sample code that demonstrates how to draw a gray background on a new blank page:

QP.SetFillColor(0.5, 0.5, 0.5);
QP.SetOrigin(1);
QP.DrawBox(0, 0, QP.PageWidth(), QP.PageHeight(), 2);
QP.SaveToFile("background-color.pdf");

The "background-color.pdf" file will include nothing but the gray background. You can then add whatever other elements you want (text, images, etc) to the document.


© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum