I'm trying to write a Java code to manually create a PDF file, I don't need an API, the PDF structure is simple enough to create it myself, but this was until I confronted the complexity of introducing Arabic Unicode characters.
I'm using a text editor to tamper with a sample PDF file I took from Make your own PDF file – Hello World.
Now I want to use the same Helvetica font provided with Adobe and I want to (using only a text editor) write in Arabic letters a simple Hello World PDF file that I can use as a sample to build upon.
Here is the sample I'm working on:
%PDF-1.4
1 0 obj <<
/Type /Catalog
/Pages 1000000 0 R
/Outlines 900000 0 R
/PageMode /UseOutlines
>>
endobj
2 0 obj <<
/Type /Font
/Subtype /Type1
/BaseFont /Helvetica
>>
endobj
3 0 obj <<
/Type /Font
/Subtype /Type1
/BaseFont /Helvetica-Bold
>>
endobj
4 0 obj <<
/Font <<
/F1 2 0 R
/F2 3 0 R
>>
>>
endobj
5 0 obj <<
/Title (Cover)
/Dest [6 0 R /XYZ null 841.890 null]
/Parent 900000 0 R
/Next 10 0 R
>>
endobj
6 0 obj <<
/Type /Page
/Parent 1000000 0 R
/Resources 4 0 R
/Contents 7 0 R
>>
endobj
7 0 obj <<
/Length 44
>>
stream
BT /F2 24 Tf 175 720 Td (Cover)Tj ET
BT /F1 24 Tf 175 696 Td (Hello World!)Tj ET
BT /F1 24 Tf 175 672 Td (Hello World!)Tj ET
endstream
endobj
10 0 obj <<
/Title (Content)
/Dest [11 0 R /XYZ null 841.890 null]
/Parent 900000 0 R
/Prev 5 0 R
/Next 15 0 R
>>
endobj
11 0 obj <<
/Type /Page
/Parent 1000000 0 R
/Resources 4 0 R
/Contents 12 0 R
>>
endobj
12 0 obj <<
/Length 44
>>
stream
BT /F2 24 Tf 175 720 Td (Content)Tj ET
BT /F1 24 Tf 175 696 Td (Hello World!)Tj ET
BT /F1 24 Tf 175 672 Td (Hello World!)Tj ET
endstream
endobj
900000 0 obj <<
/First 5 0 R
/Last 10 0 R
/Count 2
>>
endobj
1000000 0 obj <<
/Type
/Pages
/MediaBox [0 0 595.276 841.890]
/Count 2
/Kids [
6 0 R
11 0 R
]
>>
endobj
xref
0 7
0000000000 65535 f
0000000009 00000 n
0000000056 00000 n
0000000094 00000 n
0000000161 00000 n
0000000216 00000 n
0000000317 00000 n
trailer <<
/Size 7
/Root 1 0 R
>>
startxref
100
%%EOF