Hello.
I used Spire.PDF to play Flatten with Python, but it's becoming Flatten with the image gone.
I want to play Flatten without the image disappearing, what should I do?
def download_file(url, file_path, flatten_file_path=None, type=None):
try:
response = requests.get(url, stream=True)
if response.status_code == 200:
with open(file_path, 'wb') as f:
for chunk in response.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
if type == "form":
doc = PdfDocument()
# Load a PDF file
doc.LoadFromFile(file_path)
doc.Form.IsFlatten = True
doc.SaveToFile(flatten_file_path)
doc.Close()
return True
else:
return False
except Exception as e:
raise e