On 18.02.2025 18:54, wolfgang bauer (D) wrote:
I want to write a program, that creates a pdf-file. It works. But I need to define not only the
foreground-color of characters but also the background color.
I can change the foreground-color by using the command "rg". Is there a similar command for the background color ?
Draw a box in the background color an then write the text.
Don't know if the appended pdf file works if you just
copy&paste it (should be 3565 byte). If not, you can generate
it with makepdf2.exe form
https://www.onlib.de/pub/pdf/makepdf.zip
and the input file:
<inittext []>
{1 1 0 rg 1 0 1 RG 4 w 120 700 m 480 700 l 480 600 l 120 600 l 120 700 l B } [/F6 40 Tf 2 Tr 0 1 1 rg 0 0 0 RG 2 w 1 0 0 1 180 640 Tm] Hello World
Here the pdf:
%PDF-1.2
%123 This is a binary file. Don't edit.
%created by MakePDF V 0.08 alpha
%
http://www.bitlib.de/pub/pdf/
8 0 obj
<<
/F1 9 0 R
/F2 10 0 R
/F3 11 0 R
/F4 12 0 R
/F5 13 0 R
/F6 14 0 R
/F7 15 0 R
/F8 16 0 R
/F9 17 0 R
/F10 18 0 R
/F11 19 0 R
/F12 20 0 R
/F13 21 0 R
/F14 22 0 R
endobj
9 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Courier
/Encoding /WinAnsiEncoding
endobj
10 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F2
/BaseFont /Courier-Bold
/Encoding /WinAnsiEncoding
endobj
11 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F3
/BaseFont /Courier-Oblique
/Encoding /WinAnsiEncoding
endobj
12 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F4
/BaseFont /Courier-BoldOblique
/Encoding /WinAnsiEncoding
endobj
13 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F5
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
endobj
14 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F6
/BaseFont /Helvetica-Bold
/Encoding /WinAnsiEncoding
endobj
15 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F7
/BaseFont /Helvetica-Oblique
/Encoding /WinAnsiEncoding
endobj
16 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F8
/BaseFont /Helvetica-BoldOblique
/Encoding /WinAnsiEncoding
endobj
17 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F9
/BaseFont /Symbol
endobj
18 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F10
/BaseFont /Times-Roman
/Encoding /WinAnsiEncoding
endobj
19 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F11
/BaseFont /Times-Bold
/Encoding /WinAnsiEncoding
endobj
20 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F12
/BaseFont /Times-Italic
/Encoding /WinAnsiEncoding
endobj
21 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F13
/BaseFont /Times-BoldItalic
/Encoding /WinAnsiEncoding
endobj
22 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F14
/BaseFont /ZapfDingbats
endobj
24 0 obj
<< /Length 25 0 R >>
stream
1 1 0 rg 1 0 1 RG 4 w 120 700 m 480 700 l 480 600 l 120 600 l 120 700 l B
BT
/F6 40 Tf 2 Tr 0 1 1 rg 0 0 0 RG 2 w 1 0 0 1 180 640 Tm
(Hello World) Tj T*
T*
ET
endstream
endobj
25 0 obj
167
endobj
26 0 obj
<<
/Type /Page
/Parent 23 0 R
/Resources 27 0 R
/MediaBox [0 0 595 842]
/Contents 24 0 R
endobj
27 0 obj
<<
/Font 8 0 R
/ProcSet 6 0 R
endobj
1 0 obj
<<
/Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R
/OpenAction 4 0 R
/ViewerPreferences 5 0 R
endobj
2 0 obj
<<
/Type /Outlines
/Count 0
endobj
3 0 obj
<<
/Type /Pages
/Count 1
/Kids [23 0 R ]
endobj
23 0 obj
<<
/Type /Pages
/Parent 3 0 R
/Count 1
/Kids [26 0 R ]
endobj
4 0 obj
<<
/Type /Action
/S /GoTo
/D [26 0 R /Fit]
endobj
5 0 obj
<<
/PageLayout /OneColumn
endobj
6 0 obj
[/PDF /Text /ImageC]
endobj
7 0 obj
<<
/Producer (MakePDF V0.08 alpha 08.09.11)
endobj
xref
0 28
0000000000 65535 f
0000002376 00000 n
0000002493 00000 n
0000002545 00000 n
0000002693 00000 n
0000002761 00000 n
0000002810 00000 n
0000002849 00000 n
0000000117 00000 n
0000000314 00000 n
0000000428 00000 n
0000000548 00000 n
0000000671 00000 n
0000000798 00000 n
0000000915 00000 n
0000001037 00000 n
0000001162 00000 n
0000001291 00000 n
0000001377 00000 n
0000001497 00000 n
0000001616 00000 n
0000001737 00000 n
0000001862 00000 n
0000002611 00000 n
0000001955 00000 n
0000002181 00000 n
0000002204 00000 n
0000002321 00000 n
trailer
<<
/Size 28
/Root 1 0 R
/Info 7 0 R
startxref
2916
%%EOF
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)