On 26.12.2024 04:05, 遇夜 wrote:
Can I get the font of page numbers in the PDF footer.
https://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/PrintTextLocations.java?view=markup
change it so that additional to "text.getFontSize()" you get the name
"text.getFont().getName()". Note that font subsets have weird names, you
must cut of the "+".
The output for your file is:
String[270.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]M
String[279.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]a
String[288.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]i
String[297.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]n
String[306.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]
String[315.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]T
String[324.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]i
String[333.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]t
String[342.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]l
String[351.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]e
String[360.65,101.599976 font=FAAABB+SimHei:18.0 xscale=18.0
height=9.144 space=9.0 width=9.0]
String[90.0,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=7.3320007]T
String[97.332,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]h
String[103.332,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3359985]i
String[106.668,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=4.6679993]s
String[111.334,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0]
String[114.334,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3359985]i
String[117.67,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=4.6679993]s
String[122.338,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0]
String[125.338,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3359985]t
String[128.674,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]h
String[134.674,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=5.328003]e
String[139.998,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0]
String[142.998,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=9.335999]m
String[152.334,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=5.328003]a
String[157.662,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3359985]i
String[160.998,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]n
String[166.992,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0]
String[169.992,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=5.328003]c
String[175.32,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]o
String[181.32,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]n
String[187.32,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3359985]t
String[190.656,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=5.328003]e
String[195.98401,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0
xscale=12.0 height=7.9440002 space=3.0 width=6.0]n
String[201.98401,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0
xscale=12.0 height=7.9440002 space=3.0 width=3.3359985]t
String[205.312,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0]
String[208.312,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]o
String[214.312,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.9960022]f
String[218.308,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0]
String[221.308,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3359985]t
String[224.644,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]h
String[230.644,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=5.328003]e
String[235.968,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0]
String[238.968,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3359985]t
String[242.304,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=5.328003]e
String[247.632,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=6.0]x
String[253.632,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.3360138]t
String[256.962,135.59998 font=FAAABE+TimesNewRomanPSMT:12.0 xscale=12.0
height=7.9440002 space=3.0 width=3.0].
String[295.279,775.557 font=FAAAAH+DengXian-Regular:9.0 xscale=9.0
height=5.4315 space=2.466 width=4.7430115]1
String[300.022,775.557 font=FAAAAH+DengXian-Regular:9.0 xscale=9.0
height=5.4315 space=2.466 width=2.4660034]
You'll have to decide where the "page footer" could be. In your case
it's FAAAAH+DengXian-Regular:9.0 .
Also the output coordinates seem to be java coordinates (y=0 at the
top). To draw in PDF you need to use PDF coordinates with y=0 at the bottom.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org