@@ -747,7 +747,7 @@ class PDFHexString(PDFObject):
747747 Hexadecimal string object of a PDF document
748748 """
749749
750- def __init__ (self , hexData , IS_ID = False ):
750+ def __init__ (self , hexData , IS_ID = False , IS_HASH = False ):
751751 self .asciiValue = ""
752752 self .objType = "hexstring"
753753 self .errors = []
@@ -766,6 +766,7 @@ def __init__(self, hexData, IS_ID=False):
766766 self .referencesInElements = {}
767767 self .references = []
768768 self .IS_ID = IS_ID
769+ self .IS_HASH = IS_HASH
769770 ret = self .update ()
770771 if ret [0 ] == - 1 :
771772 if isForceMode :
@@ -803,6 +804,8 @@ def update(self, decrypt: bool = False, newHexValue: bool = True):
803804 self .encryptedValue = self .value
804805 if self .IS_ID :
805806 self .value = f"<{ self .rawValue } >"
807+ if self .IS_HASH :
808+ self .value = self .rawValue
806809 except :
807810 errorMessage = "[!] Error in hexadecimal conversion"
808811 self .addError (errorMessage )
@@ -7033,7 +7036,7 @@ def removeError(self, errorMessage="", errorType=None):
70337036 self .errors .remove (error )
70347037
70357038 def save (
7036- self , filename , pdfPath , version = None , malformedOptions = None , headerFile = None
7039+ self , filename , version = None , malformedOptions = None , headerFile = None
70377040 ):
70387041 if malformedOptions is None :
70397042 malformedOptions = []
@@ -7179,7 +7182,7 @@ def save(
71797182 self .body [v ].setObjects (indirectObjects )
71807183 offset = len (outputFileContent )
71817184 if os .sep not in filename :
7182- outputPath = f" { pdfPath } { os .sep } { filename } "
7185+ outputPath = os .path . realpath ( filename )
71837186 else :
71847187 outputPath = filename
71857188 if isinstance (outputFileContent , str ):
0 commit comments