PDF generation fails with translations

Hi SurveySolutions,

We are facing an issue with a questionnaire (bedb5e47-6f4a-47d9-a2af-b720b981d9ff) and more specifically with at least two of its translations (Hindi: fb2aadf3-27b2-bb42-8ef1-0f6135e97016 and Chichewa: db62f8a6b6fb00f5f11a558f818b1f59). Please be aware that we have now removed these translations from the latest version of the questionnaire so that we can work with it again. You will find the problematic translations in revision 7575 of the questionnaire.

Now, with these translations, the questionnaire fail to import into HQ with the following log:

hq_1        | [10:02:28 INF] Headquarters Failed to import questionnaire from designer. RestException
hq_1        | WB.Core.Infrastructure.HttpServices.HttpClient.RestException: Not Found
hq_1        |  ---> WB.Core.Infrastructure.HttpServices.HttpClient.ExtendedMessageHandlerException: Request GET https://designer.mysurvey.solutions/pdf/download/bedb5e47-6f4a-47d9-a2af-b720b981d9ff?translation=fb2aadf3-27b2-bb42-8ef1-0f6135e97016 failed with status code 404 (Not Found).
hq_1        |    at WB.UI.Headquarters.Services.Impl.DesignerRestServiceHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in /src/UI/WB.UI.Headquarters.Core/Services/Impl/Designer/DesignerRestServiceHandler.cs:line 82
hq_1        |    --- End of inner exception stack trace ---
hq_1        |    at WB.UI.Headquarters.Services.Impl.DesignerRestServiceHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in /src/UI/WB.UI.Headquarters.Core/Services/Impl/Designer/DesignerRestServiceHandler.cs:line 82
hq_1        |    at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
hq_1        |    at Refit.RequestBuilderImplementation.<>c__DisplayClass14_0`2.<<BuildCancellableTaskFuncForMethod>b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 291
hq_1        | --- End of stack trace from previous location ---
hq_1        |    at WB.Core.BoundedContexts.Headquarters.Implementation.Services.PdfQuestionnaireImportStep.DownloadPdf(Action incrementProgress) in /src/Core/BoundedContexts/Headquarters/WB.Core.BoundedContexts.Headquarters/Implementation/Services/QuestionnaireImport/PdfQuestionnaireImportStep.cs:line 101
hq_1        |    at WB.Core.BoundedContexts.Headquarters.Implementation.Services.PdfQuestionnaireImportStep.DownloadFromDesignerAsync(IProgress`1 progress) in /src/Core/BoundedContexts/Headquarters/WB.Core.BoundedContexts.Headquarters/Implementation/Services/QuestionnaireImport/PdfQuestionnaireImportStep.cs:line 51
hq_1        |    at WB.Core.BoundedContexts.Headquarters.Implementation.Services.QuestionnaireImportService.<>c__DisplayClass14_1.<<ImportImpl>b__9>d.MoveNext() in /src/Core/BoundedContexts/Headquarters/WB.Core.BoundedContexts.Headquarters/Implementation/Services/QuestionnaireImport/QuestionnaireImportService.cs:line 245
hq_1        | --- End of stack trace from previous location ---
hq_1        |    at WB.Core.BoundedContexts.Headquarters.Implementation.Services.QuestionnaireImportService.ImportImpl(RestCredentials credentials, IServiceLocator serviceLocator, Guid userId, String userName, Guid questionnaireId, QuestionnaireImportResult questionnaireImportResult, String name, Boolean isCensusMode, String comment, String requestUrl, Boolean shouldMigrateAssignments, QuestionnaireIdentity migrateFrom, Boolean includePdf) in /src/Core/BoundedContexts/Headquarters/WB.Core.BoundedContexts.Headquarters/Implementation/Services/QuestionnaireImport/QuestionnaireImportService.cs:line 242

We also get an error when attempting to generate a PDF for any of the two languages cited above in Designer wich just says, though: “Failed to generate PDF.Please reload the page and try again or contact support@mysurvey.solutions”.

The other translations appear to act properly and do get their PDFs generated. What feels mildly bizarre is that the Hindi translation did not cause any issues until the Chichewa translation was updated from a previous version (which was also fine).

Hello @tschoel ,

I couldn’t reproduce the issue. The Designer has generated the PDF rendering of the questionnaire with the specified ID bedb5e47-6f4a-47d9-a2af-b720b981d9ff in Chichewa_Malawi_Revised2 language, which appears available.

If you encounter the issue again, try to clone and preserve the questionnaire at that point.

Best, Sergiy

Try this one (I hope you can):


And then export Hindi from there.

Best, Thorsten

Dear Thorsten,

thank you for sharing the updated link. Yes, I’ve managed to observe the error with producing the PDF with this version. Will discuss with the colleagues. However, when I create a clone of this questionnaire it rectifies the problem and produces the PDF (specifically in Hindi as you wished).

This could be a workaround if you need to import the questionnaire to the HQ or produce a PDF in the meanwhile.

Hope this helps.

Best, Sergiy Radyakin

I have discussed with my colleague and we agreed:

  • the current behavior is buggy;
  • the workaround shown above to extract the earlier revision to generate the PDF is valid and is the shortest way to obtain a PDF of an earlier revision.

This will be included into the fixes pipe-line.

Dear Sergiy,

This is still hitting us and it renders the questionnaire pretty much useless because HQ wants to also download the PDF during import and refuses to complete the import when PDF generation fails. We are still talking about the same questionnaire, but by now all languages are affected, including the base language (English). I tried to create a copy of the questionnaire which didn’t help. I also tried to delete all translations, which didn’t help either. Could you fix this in the short term? Or can you think of any sort of work-around, e.g. telling HQ not to download the PDF during import of the questionnaire?


Oh and: even going back to revisions that we were able to export a PDF from before (and that we have successfully imported into HQ before) no longer helps.

No, PDF is always requested from the Designer during the import of the questionnaire to an HQ server.

Perhaps it is a different issue, not related to the translations.
My immediate observation is that the questionnaire contains a huge number of sub-sections. While nominally this should be fine, realistically this tells me about some inefficiencies in your questionnaire design. With number of questions being equally large, my first reaction is to concentrate on the questionnaire optimizations.

If you’ve already created a copy, use it as a sandbox and cut one section after another until it produces the PDF. Either you will get below some unknown limit at some point, or will cut off some element which is causing the PDF renderer to fail. In both cases we will learn something.

Just tried PDF generation for a different questionnaire and it worked. So this issue Error downloading PDF version of the Questionnaire is not currently affecting.