[ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers only - Please do not post requests for older versions of PDF-XChange or the PDF-Tools/OFFice2PDF applications here

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
Seidenweber
User
Posts: 20
Joined: Sat Aug 24, 2013 9:14 pm

[ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

Post by Seidenweber »

The default macro for filenames in the printer driver is %[DocName].

So when I print a file named Document1.docx from Word, the PDF name should be Document1.pdf.

If I print the same file 3 times, the generated names should be Document1.pdf, Document1-001.pdf and Document1-002.pdf.

I have just printed the empty default Dokument1 file 3 times using Word's quick print function. The following file names were generated:
1.) Dokument1.pdf
2.) Dokument1ᓽᔎ.pdf
3.) Dokument1ᓽᔎ-001.pdf

Then I did the same with Excel. The german default name for new documents is "Mappe" (german for file or folder or something like that)
1.) Mappe1ȄЄ༄pp.pdf
2.) Mappe1ȄЄ༄.pdf
3.) Mappe1ȄЄ༄-001.pdf

I also get forbidden characters (including control codes like Chr(1)), which of course lead to an error message - OR cause printouts to be simply skipped and lost.
grafik.png
Here I got the file name Kontosalden1 (Datenbank 1)㕝5䴀ಡ@움鵎ǀ.pdf.
Kontosalden1 (Datenbank 1).pdf would have been correct.

In such situations 20++ files (sometimes 50++) are printed and each one can potentially generate an error message if the file name contains forbidden characters.

The problem always seems to occur when the file name is automatically assigned by the print software and passed to the driver.
If I open and print out a file that I have named myself, the problem has not yet occurred (but that can still come).

It is probably self-explanatory that I'm somewhat unhappy...
Any suggestions?

==== Update 30.08.2020 (22:33)
In the meantime I've done a little research and found the file titrules.js.

To me it looks like one could tweak the eliminateBadChars() function to solve the problem.

But to be honest, regular expressions are just Greek to me. And all I know about Javascript is that it exists.

Code: Select all

function eliminateBadChars(s)
{
//	var r = /[\/\\<>:"\|\?\*]/g;
//	return s.replace(r, "_");
	return s;
}
If there is no better solution, please could someone write me a function that removes all characters from docName except ÄÖÜäöüß A-Z a-z 0-9 [ ] ( ) @ hyphen, dot and space?

I would be very grateful.

My Settings (German)
My Settings (German)
grafik.png
PDF-XChange PRO || Win10 Pro x64 || Intel Core i9-9900k || 64 GB RAM || Nvidia RTX 2080 ti || OKI ES5162 MFP
Seidenweber
User
Posts: 20
Joined: Sat Aug 24, 2013 9:14 pm

Re: [ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

Post by Seidenweber »

Without knowing what exactly I'm doing, I made the following. For the moment it seems to be working.
Far from "perfect" but at least I don't get error messages when the driver tries to save the file.
Nevertheless, there are still unwanted characters in the file name, but they are generally allowed - even if they don't belong there.

Code: Select all

function eliminateBadChars(s)
{
//                             [     ]     (     )     .     _     -     Ä     ä     Ö     ö     Ü     ü     ß
	return s.replace(/[^\u005b\u005d\u0028\u0029\u002e\u005f\u002d\u00c4\u00e4\u00d6\u00f6\u00dc\u00fc\u00df A-Za-z0-9]/g, "");
}
Right now I feel like someone who bought a car that you can only drive in a straight line.
Now I'm trying to create something like a steering system.

Maybe someone else has a better suggestion.
Last edited by Seidenweber on Tue Sep 01, 2020 12:13 am, edited 1 time in total.
PDF-XChange PRO || Win10 Pro x64 || Intel Core i9-9900k || 64 GB RAM || Nvidia RTX 2080 ti || OKI ES5162 MFP
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6836
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: [ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

Post by Paul - Tracker Supp »

Hi Seidenweber,

can you confirm that these tests were performed using the current build? 8.0.341.0 is current. Help --> Check for updates or direct download from here: https://www.pdf-xchange.com/product/downloads

Install directly over any existing V8 instance, uninstall first if it is V7 or earlier on there now.

Looking forward to hearing if this is an issue in 8.0.341.0.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Seidenweber
User
Posts: 20
Joined: Sat Aug 24, 2013 9:14 pm

Re: [ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

Post by Seidenweber »

Paul - Tracker Supp wrote: Mon Aug 31, 2020 5:41 pm can you confirm that these tests were performed using the current build? 8.0.341.0 is current.
Looking forward to hearing if this is an issue in 8.0.341.0.
grafik.png
Hi Paul,

All I wrote is related to build 341 from Aug 12 2020.
And it was installed on a fresh and clean Windows 10 x64 (v.2004) without older versions of Tracker-Software or any other 3rd party PDF-related Apps.
PDF-XChange PRO || Win10 Pro x64 || Intel Core i9-9900k || 64 GB RAM || Nvidia RTX 2080 ti || OKI ES5162 MFP
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: [ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

Post by Ivan - Tracker Software »

Thanks for your report.
The issue is found and fixed. Fix will be available in the next build.

As a workaround for now, please uncheck the option "Strip Path from Document Name".
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Seidenweber
User
Posts: 20
Joined: Sat Aug 24, 2013 9:14 pm

Re: [ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

Post by Seidenweber »

Ivan - Tracker Software wrote: Tue Sep 01, 2020 11:25 pmAs a workaround for now, please uncheck the option "Strip Path from Document Name".
Hi Ivan,
thanks for the info.
I removed my changes from the titrules.js, unchecked the option "Strip Path from Document Name" and repeated all tests.
All filenames are now as intended.

At certain points the banking software 'SFirm' now passes 'rundll32' as a filename (should be "Untitled"), but that is meaningless.

For the moment that's ok. Thanks for resolving this so quickly.
PDF-XChange PRO || Win10 Pro x64 || Intel Core i9-9900k || 64 GB RAM || Nvidia RTX 2080 ti || OKI ES5162 MFP
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6836
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

[ISSUE] wrong or even forbidden characters in filenames when using the macro %[DocName].

Post by Paul - Tracker Supp »

:)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply