Q: If a PDF has a password with double quotations, we can't open and convert the PDF.
If PDFTron PDF2Image SDK offers escaped double quotations, please show us the escape sequence.
A part of our C# code sample is as below.
Suppose "documentpassword" variable contains double quotations in a normal way on C#.
String cmd = "--op on ";
cmd += "--config \"" + Param.PDF_FONTCONFIG_FILEPATH + "\" ";
if (0 < dpi) cmd += "--dpi " + dpi + " ";
if (null != documentpassword && 0 < documentpassword.Length)
cmd += "--pass \"" + documentpassword + "\" ";
if (_endpage == Param.NO_MAX_NUMBER_OF_PAGES)
cmd += "-a " + _startpage.ToString() + "- ";
else
cmd += "-a " + _startpage.ToString() + "-" + _endpage.ToString() + " ";
cmd += "-f " + outputformat + " --prefix " + outputfileprefix + " --
digits 1 -o \"" + outputfolder + "\" \"" + targetfullpath + "\"";
GCHandle gch = GCHandle.Alloc(this, GCHandleType.Normal);
ret = PDF2ImageRun(cmd, mycallback, GCHandle.ToIntPtr(gch));
--------------
A: You can specify any password by surrounding it with quotes and escaping any quote characters in the password. For example:
PDF2ImageRun("-f png in.pdf --pass "\ 1 303 3 \" ", 0, 0);
decodes the encrypted file with password ‘ 1 303 3 ’.
If the password contains any quotes you may need to escape them.
For example:
"-f png in.pdf --pass \"\\\"\" "
Translates into...
-f png in.pdf --pass "