Hello .. Good night.
Is it possible with spire to modify the intensity of colors in an existing pdf file?
Something that made it possible to apply a degree of intensity.
Is there anything like that in the api?
Thanks in advance!
//load pdf
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("test.pdf");
//traverse all pages of the document
foreach (PdfPageBase page in pdf.Pages)
{
//set page background color
page.BackgroundColor = Color.LightSkyBlue;
page.BackgroudOpacity = 0.1f;
}
//Save the document
pdf.SaveToFile("result.pdf");
//create a file and set its background
PdfDocument doc1 = new PdfDocument();
PdfPageBase page1 = doc1.Pages.Add(PdfPageSize.A4, new PdfMargins(0));
page1.BackgroundColor = Color.LightGray;
page1.BackgroudOpacity = 0.4f;
//load the original file
PdfDocument doc2 = new PdfDocument();
doc2.LoadFromFile("Original.pdf");
//Create the template from doc1
PdfTemplate template = doc1.Pages[0].CreateTemplate();
foreach (PdfPageBase page in doc2.Pages)
{
//set PDF overlay effect and set transparency mode
page.Canvas.SetTransparency(0.1f, 0.1f, PdfBlendMode.Overlay);
//draw template
page.Canvas.DrawTemplate(template, PointF.Empty);
}
//Save pdf file.
doc2.SaveToFile("result.pdf");