TPdfWriter: Merge/Attach files?

I need to merge different files (images and pdfs mostly) in a single pdf. I see that TPdfWriter::AttachFile does that..kinda.
(I tried different TPdfAttachmentKind, but I always got the same result.)

For what I see when you attach a file to a PDF basically you get a ZIP archive. When you click on the attachment you open it in a new window with the default viewer. For instance, on my pc when I open a png I've been asked to save it on the drive, while pdf attachments are opened in a separate window.

I was hoping for a more integrate solution (I don't know if it is achievable): a single PDF document with an index, I click on an entry and I jump to the page. I don't care if the pages have different sizes/format.


Attaching files to pdf is a pdf feature, we can't change it. We just implement the attached files section in the pdf spec, it is up to the viewer on how it displays those files. It is designed mostly to attach other kind of files to a pdf, so for example you could have a pdf and embed the xls or csv with the data you used to create that pdf. 

Attaching is the only feature of PDF/A3 over PDF/A2: and as said, it is designed mostly to attach the raw data you used to create the pdf, in case someone wants to process it. I think this is the reason it isn't integrated: If you attach an xlsx file to a pdf file, the xlsx can't open in the pdf reader. 

If what you are looking for is to merge existing pdf files, then sadly pdf writer isn't the tool to do that. But if you are creating a new pdf, then you can create an index, and you can embed a png file by calling pdfwriter.DrawImage.

What tool/class would you suggest to merge pdf files programmatically? Is it possible to do within TMS FlexCel?

I honestly don't know about the other tools, but I imagine there might be a lot. In the case of pdfwriter, the problem is that it is just a writer, not a reader, so it can't parse existing pdf files. (you need to read the existing pdf files to merge them).

I am really sorry I can't help more here, but I have no real experience in tools for merging pdf files. 

Thanks Adrian for the clarification. For now I think I'm going to use the Attachments, they are not so bad after all.