MODX Community

PDFResource incorrect PDF file names

PDFResource is a great extra for the purpose I need thanks so much @jako and works flawlessly to build the PDFs, but the one thing I can’t work out is an issue with the file name.

When I first save a document, PDFResource creates an assets/pdf/parent folder as it should, but on closer inspection the directory has the following structure, e.g.

assets
… pdf
… … north-america
… north-americaproject-one-name.pdf
… north-americaproject-two-name.pdf
… north-americaproject-three-name.pdf

So in other words, the pdf is created as expected but it is not created inside the parent folder, and the name is also being prefixed with the parent folder name, but with no dash separating the parent and child name. This is really quite minor, and for my purposes I don’t need the PDFs to either be in the parent folder or have the parent name prefixed to them, but it’s just a bit messy file name wise.

I’ve tried but I’m not an extras magician and I can’t make out where the directory path is being put together by the extra - can anyone offer some help to tidy up the PDF file name?

BTW, linking to the PDFs with pdfresourcelink works fine, so it seems the issue is also generated when the link is created too.

Thanks in advance.

1 Like

To calculate the path for the current resource, PDFResource creates the path for the parent resource, replaces an extension with a slash and appends the alias of the current resource and the suffix .pdf. It happens here: https://github.com/Jako/PDFResource/blob/9322bbd18b78b6a001b3512dc4f2181b4d34307e/core/components/pdfresource/model/pdfresource/events/pdfresourceondocformsave.class.php#L19

1 Like

Thanks for the reply, I’ll look at this some more, but is that the expected result for the file name (parent-folderdocument-name.pdf)?

i.e. without a dash between ‘parent-folder’ and ‘document-name.pdf’.

I don’t have that issue in my installations with PDFResource. Do you have custom container_suffix system setting?

Please try the release candidate of pdfresource 1.5.9: https://github.com/Jako/PDFResource/raw/1.5.9-rc1/_packages/pdfresource-1.5.9-rc1.transport.zip

Hi, I’ve installed 1.5.9 and it has fixed the issue thank you! My container_suffix setting was a ‘/’ which I think is fairly standard.

The path is exactly as I would expect now, e.g.

assets
… pdf
… … north-america
… … … project-one-name.pdf
… … europe
… … … project-two-name.pdf

Thanks for your help, this is a great plugin (enjoy the beers!)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.