I want to merge two PDF files but when the input filename has some special characters such as ª or º etc., it fails to merge. With an input filename like MªRose.pdf.
try
SetLength(Arg, 7);
Arg[0] := PAnsiChar('-q');
Arg[1] := PAnsiChar('-dSAFER');
Arg[2] := PAnsiChar('-dNOPAUSE');
Arg[3] := PAnsiChar('-dBATCH');
Arg[4] := PAnsiChar('-sOutputFile=' + output + '.pdf');
Arg[5] := PAnsiChar('-sDEVICE=ps2write');
Arg[6] := PAnsiChar(input);
ExitCode := gsapi_init_with_args(instance, Length(Arg), @Arg[0]);
if ExitCode < 0
then raise Exception.Create('ERROR: init_args: '+IntToStr(ExitCode));
gsapi_exit(instance);
finally
gsapi_delete_instance(instance);
end;
Can someone provide a solution?
gsapi_set_arg_encoding( instance, GS_ARG_ENCODING_UTF8 );and then to use UTF-8 AnsiStrings. Oh, andArg[0]is always ignored.