Creating a single pdf from multiple files - why are some missing?

I have a shortcut that takes a bunch of Word docs, converts them to pdfs and then creates a pdf that is supposed to contain all of the individual pdfs. This almost works, but the final pdf always seems to be missing one or two pdfs. It’s not the first two (based on name), or the first and the last.
Are there any reasons anyone can think of why files are being missed? They’re roughly the same size as the others. The file names aren’t longer than files that are added successfully.

1 Like

Without being able to run your shortcut, we would just be taking wild guesses as to what the issue could be.

How are you converting Word docs to PDFs? Is it just the native Shortcuts action or something more effective? I’m terribly curious as I’ve spent substantial time working on getting Office file conversions in Shortcuts. Please share your shortcut!

I’m just using the native Make PDF action.
Here’s the shortcut.

Thanks all!

Do each of those Word documents definitely get converted to PDF? I would be surprised if the Make PDF action would work reliably as a way to convert a Word document on its own. I’m wondering if there is something in some Word documents that would be complex enough to cause the conversion some issues. It might be interesting to try a quick look on each file too as if that is the case, it might also suffer from similar rendering issues.

Yeah, they all get converted to pdfs. I save a copy of the individual files before I create the combined pdf. It doesn’t do a perfect job (the paging can be different), but it’s good enough for what I need to do with them (annotate in GoodNotes).

Ok. See if this version makes any difference. It stores the converted PDFs in a variable and it should build the final PDF from that directly rather than from the file system copies.

Unfortunately it missed 3 files with the shortcut you sent. I wish Shortcuts had a debug mode. :grin:

:thinking:

Next suggestion is to try incrementally adding the PDFs rather than combining them all at once. This shortcut loops over the PDFs and should add them to one another one by one, creating a new PDF to add the next one to each time.

Also a few questions.

  1. Does the issue vary which PDFs get dropped when run multiple times on the same files?
  2. If not, do the dropped PDFs on their own combine okay?
  3. What volume of original files (number and approx file size) are causing the issue.

Combining PDFs usually works fine so I’m leaning towards a data issue.something related to particular documents, something related to memory consumption. It’s all remote guesswork at this point.

It looks like the incremental adding worked! I got all 13 documents this time. To answer your questions:

  1. I haven’t tested that. I’ll take a look.
  2. Ditto
  3. Anywhere from 6 to 20 files. The files are only around 100 - 300 KB, so I’d be surprised if it’s a memory issue.

Thanks so much for your assistance!

Great. Looks like you have something functional for now and avenues of investigation if you get further issues.

:+1:t2:

1 Like