blackbox/AuxUpload documentation


I was looking for a way to upload files to the WebViewer Server (in a Docker container) and I saw inside the provided JavaScript WVSApiWrapper.js that GetPDF is actually using blackbox/AuxUpload?type=upload to upload the file first.
Is there any documentation for this API? I can’t find anything.
I’m actually trying to use it from C# .Net6 to preprocess files.

Thank you.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hi Aleksandar,

Please refer to this guide for the WVS API wrapper: WebViewer Server API Wrapper

Please let me know if this is not what you are looking for.

Best Regards,
Ahmad Moaaz
Software Developer
PDFTron Systems Inc.

Thank you for the reply, but this is not what I really need.
I managed to upload files using this code:

RestClient client = new RestClient("http://x.x.x.x:port");
RestRequest UploadRequest = new RestRequest("blackbox/AuxUpload?type=upload");

UploadRequest.AddQueryParameter("bcid", GenerateCacheKey(ObjRid, FileRid, SaveCount));
UploadRequest.AddQueryParameter("ext", FileExt, false);
UploadRequest.AddQueryParameter("linearize", "true", false);
UploadRequest.AddFile("file", fileContent, FileName);

RestResponse restResponse = client.Execute(UploadRequest, Method.Post);

But it doesn’t look like the files get converted to PDFs.

What I need is to upload a file and convert it without receiving the PDF. Only a confirmation it’s been converted or an error code.

I think the first step is done. How can I force the uploaded file to get converted to PDF?
All this in C#.

Thank you.

After looking at WVSApiWrapper.js, I think I see what I have to do.
I have to get the restResponse.ResponseUri from the AuxUpload request and use it as URI for GetPDF API.

For these who are looking for preprocessing files here is a code that is working for me.
Make sure the cacheKey is unique.:

  string cacheKey = GenerateCacheKey(...your parameters...);

  RestClient client = new RestClient("http://x.x.x.x:8099");
  RestRequest UploadRequest = new RestRequest("blackbox/AuxUpload?type=upload");

  UploadRequest.AddQueryParameter("cacheKey", cacheKey, false);
  UploadRequest.AddQueryParameter("ext", FileExt, false);
  UploadRequest.AddFile("file", fileContent, FileName);

  RestResponse restUploadResponse = client.Execute(UploadRequest, Method.Post);

  if (!restUploadResponse.IsSuccessful)
      //throw or log the error
      var jsonresult = JsonDocument.Parse(restUploadResponse.Content);
      var uri = jsonresult.RootElement.GetProperty("uri").GetString();

      RestRequest getPdfRequest = new RestRequest("blackbox/GetPDF");

      getPdfRequest.AddQueryParameter("uri", HttpUtility.UrlEncode(uri), false);
      getPdfRequest.AddQueryParameter("cacheKey", cacheKey, false);
      getPdfRequest.AddQueryParameter("ext", FileExt, false);
      getPdfRequest.AddQueryParameter("linearize", "true", false);

      RestResponse restGetPdfResponse = client.Execute(getPdfRequest, Method.Get);

      if (!restGetPdfResponse.IsSuccessful)
          //throw or log the error

Function GenerateCacheKey. You can generate an unique key any way you like. In my case I use 4 parameters:

public static string GenerateCacheKey(long a1, long a2, long a3, int a4)
    return $"{a1}_{a2}_{a3}_{a4}";