I unable to extract pdf file from zip folder

Hello I am facing an issue with some zip folder. In my case everyday i recevie a zip folder report I need to unzip the folder and extract only pdf file to extracted folder. In my zip folder i get 2 files one is pdf nd another is .mp file. I have created the workflow and for some zip report I am able to extract only pdf file.

But the problem is In some zip folder pdf file is not extracting only .mp file extracted and throw an error called “transformfinalblock is not implemented and inputcount is greater than 0”. Another error i also get
“Read PDF Text: Unexpected PDF structure. This exception usually indicates that PDF document is malformed but also may indicate a bug in Docotic.Pdf library”.
Is the issue from pdf file side. Because i verified all pdf property it all same only.

Hello I am facing an issue with some zip folder. In my case everyday i recevie a zip folder report I need to unzip the folder and extract only pdf file to extracted folder. In my zip folder i get 2 files one is pdf nd another is .mp file. I have created the workflow and for some zip report I am able to extract only pdf file.

But the problem is In some zip folder pdf file is not extracting only .mp file extracted and throw an error called “transformfinalblock is not implemented and inputcount is greater than 0”. Another error i also get
“Read PDF Text: Unexpected PDF structure. This exception usually indicates that PDF document is malformed but also may indicate a bug in Docotic.Pdf library”.
Is the issue from pdf file side. Because i verified all pdf property it all same only.

Action: Merged Duplicates

Hi @NagaSujitha,

First use Extract/Unzip Files to extract all files. Then, iterate through the extracted folder and delete every file that doesn’t have a .pdf extension. After that, perform your required actions on the remaining PDF file.

If the failure occurs during Unzip Files, the ZIP itself may be corrupted or created using an unsupported compression method. UiPath does not support extracting files compressed with Deflate64, PPMd, or XZ. Try to unzip and check if encoutner the same error.

Thanks

Hi @NagaSujitha

I think those two errors are connected, and the root is the unzip step, not the PDF itself. Checking the PDF properties probably will not show it, because the problem is how that file is stored inside the zip, not the content

The TransformFinalBlock one is a decryption failure. It shows up when the zip entry is encrypted or uses a compression method the UiPath unzip cannot handle. So the zips that work are stored normally, and the failing ones have the PDF entry either password protected or compressed with something like Deflate64 or AES that the activity does not support. The .mp file comes out fine because it is stored the supported way, and the PDF is the one that breaks.. the Read PDF error after that is just the side effect, no clean PDF ever landed so Read PDF gets a missing or broken file and throws the malformed structure message

To confirm you can open one of the bad zips in 7zip or WinRAR, look at the Method column on the PDF entry and check if it asks for a password. If it is encrypted or an unsupported method, the native activity will not do it, so the reliable fallback is calling 7zip from command line with an Invoke Process, 7z x handles all those methods and passwords. Extract to a folder and only run Read PDF after you check the .pdf actually exists and is bigger than zero, that also stops the second error from masking the real one

I don’t know this error, but if were unable to use built-in activities to extract, I would try using external application like 7zip, with command line expression, using Start Process.
And if zip file is corrupted there’s nothing automation can do about it, just contact the person who provides the file.
Edit: I see @Michael.Vornes suggests similar approach. Sorry for reduntant post :sweat_smile:

Since your workflow works for most ZIP files, the issue is likely with the PDF in those specific ZIP files. The “Unexpected PDF structure” error usually means the PDF is damaged or not in a format that the PDF reader can process correctly. Try extracting the PDF manually and check if it opens properly. If only a few files fail, compare them with the working ones to identify any differences.

Regarding this query can you try sharing screen shot if possible, also is there delay given properly.

Also Are you able to access those pdf manually which are not extracted from zip