You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bug is observed in the official document in annotation part. The the font_color is always the same as the border_color, and cannot be changed. As the example shown in the document, the font_color is supposed to be green, but it remains blue, which is the same as border_color.
frompypdfimportPdfReader, PdfWriterfrompypdf.annotationsimportFreeText# Fill the writer with the pages you wantpdf_path=os.path.join(RESOURCE_ROOT, "crazyones.pdf")
reader=PdfReader(pdf_path)
page=reader.pages[0]
writer=PdfWriter()
writer.add_page(page)
# Create the annotation and add itannotation=FreeText(
text="Hello World\nThis is the second line!",
rect=(50, 550, 200, 650),
font="Arial",
bold=True,
italic=True,
font_size="20pt",
font_color="00ff00",
border_color="0000ff",
background_color="cdcdcd",
)
writer.add_annotation(page_number=0, annotation=annotation)
# Write the annotated file to diskwithopen("annotated-pdf.pdf", "wb") asfp:
writer.write(fp)
The text was updated successfully, but these errors were encountered:
The bug is observed in the official document in annotation part. The the font_color is always the same as the border_color, and cannot be changed. As the example shown in the document, the font_color is supposed to be green, but it remains blue, which is the same as border_color.
The text was updated successfully, but these errors were encountered: