Pdf-maker

Latest version: v0.0.51

Safety actively analyzes 682416 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 4

0.0.39

* Issue found: plus-minus sign cannot be displayed correctly.

This issue seems to be caused by the encode procedure, for example, the character "±" (unicode 00B1) will
be converted to b'\xc2\xb1' with encode('utf-8'). Thus I found only characters between 0 to 127 in ASCII set
can be displayed correctly.

s = "=±=≤"
for i in s:
print(i.encode('utf-8'))

b'='
b'\xc2\xb1' this is converted by "±" but will convert to "±".
b'='
b'\xe2\x89\xa4' this is converted by "≤" but will convert to "â\x89¤".

for example:
s = "±"
s.encode('utf-8')
b'\xc2\xb1'
b'\xc2\xb1'.decode('utf-8')
"±"
Up to here, everything is good, however if convert bytes to hexadecimal representation, errors happed
b'\xc2\xb1'.hex()
'c2b1'
convert bytes to charaters, will give chr(0xc2) and chr(0xb1)
delete the first two digits, i.e., only 'b1' left, then display "±" well.

Now we can successfully write the symbol "±", but fail to display other characters in Unicode set with longer
codes, such as "≤" (unicode 8804). Currently I dont exactly know how to completely solve this issue, and I tried
to use ASCII85Decode but not helpful. I'll evaluate if it is necessary to search deeper to find the perfect
solution to support more Unicode characters.

0.0.38

* Fix the display error of double quotation marks, which was missed in the subset font files.

0.0.37

* Note that font name should be postScriptName of a font, i.e., BaseFont attribute in Font object, and
FontName attribute in FontDescriptor object, otherwise, some pdf reader like Chrome Browser can read it
correctly, but Adobe Acrobat will show warning and replace by other built-in fonts.

0.0.36

* Fix the error of embedding fonts.

Source font file size:

![alt text](image-2.png)

Extracted font file size:

![alt text](image-3.png)

There is a difference of 4 bytes. The extracted file missed four charachters. So the issue might happen
during the hex encoding procedure.

![alt text](image-4.png)

Furtherly, it is noticed that the difference happens after the realignment of the hexadecimal representation,
in which errors might happen.

![alt text](image-5.png)

Finally identify the issue: should be len(hex_stream) // 64 instead of that + 1.

![alt text](image-6.png)

Three fonts are all embedded.

![alt text](image-7.png)

0.0.35

* Add multiply fonts to pages.
* TrueType fonts like Arial are displayed well now, but Type 1 font don't work well.
Possible reason: comparing extracted font file by pdf-parser.py from the pdf and the source file times.ttf,
it is found that extracted font file lost some information. Times ttf might be not TrueType font.

![alt text](image.png)

![alt text](image-1.png)

0.0.34

* Try to solve the embedding issue, some potential problems found: length calculation of the font file
stream.
* A javascript module named [fontsubset](https://github.com/flashlizi/fontsubset) can be used to extract
subset from a full font file so the size of pdf with embedded font files can be decreased.
Usage: fontsubset -s "String containing characters might be included" fontFile outputFile

Page 3 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.