Is there any way when using Color.from_argb()
Instead of giving the rgb values like (255,0,0) to make it automatically change the R value +/- 5 for every letter i set it.
Can you please share the complete chunk of code for our reference where you are using the Color? We will investigate feasibility of your requirements in your case and share our feedback with you.
Here is an example where i extract the text from a pdf and color the letter A with RED (255,0,0).
The question is: instead of giving a triplet of rgb values if the pdf.Color can change the letter color +/- 5 in one of the three values.
# Search text
inputPDFFile.pages.accept(txtAbsorber)
# Get reference to the found list
textFragmentCollection = txtAbsorber.text_fragments
# Parse all the searched text fragments
for txtFragment in textFragmentCollection:
txtFragment.text = "A"
txtFragment.text_state.foreground_color = pdf.Color.from_argb(255, 0, 0)
# Save the output PDF
inputPDFFile.save("output.pdf")
We have logged an investigation ticket as PDFPYTHON-121 in order to analyze the feasibility of your requirements. We will look into its details and keep you posted with the status of its resolution. Please be patient and spare us some time.
1 Like