Question T10802
Visible to All Users

Arabic Font not working at Export PDF

created 2 years ago (modified 2 years ago)

I am try to export pdf using Arabic language but the data not rendered.
this is my code

Code
//get survey data var surveyResultQuestion = getQuestionnaireDetails(); //get survey result data var surveyResultAnswer = getSurveyResultDetails(); $.when(surveyResultQuestion, surveyResultAnswer).done(function(surveyResultQuestionResult, surveyResultAnswerResult) { //Render Survey result https://surveyjs.io/Examples/Library/?id=survey-quiz-results&platform=jQuery&theme=defaultV2#content-js const survey = new Survey.Model(JSON.parse(surveyResultQuestionResult.jsonDefinition)); survey.data = JSON.parse(surveyResultAnswerResult.jsonDefinition); survey.mode = "display"; survey.questionsOnPageMode = "singlePage"; survey.showProgressBar = "off"; survey.showTimerPanel = "none"; survey.maxTimeToFinishPage = 0; survey.maxTimeToFinish = 0; $("#surveyContainer").Survey({ model: survey }); function prepareSurveyPDF() { const surveyPDF = new SurveyPDF.SurveyPDF(JSON.parse(surveyResultQuestionResult.jsonDefinition)); surveyPDF.data = survey.data; surveyPDF.haveCommercialLicense = true; return surveyPDF; } function savePdfAsFile() { const surveyPDF = prepareSurveyPDF(); surveyPDF.save("surveyAsFile.pdf"); } survey .navigationBar .getActionById("sv-nav-complete") .visible = false; survey.addNavigationItem({ id: "survey_save_as_file", title: "Save as PDF", action: savePdfAsFile }); });

also I am try it at you website and it's not working also using this link
https://surveyjs.io/form-library/examples/survey-localization/jquery
with lang ar

Answers approved by surveyjs Support

created 2 years ago (modified 2 years ago)

Hello,
You may know that we render PDF surveys using a third-party jsPDF library. It uses multiple default fonts, however, they may not contain glyphs required to render texts in a specific locale. So, you can add a custom font which contains required glyphs.

I've created the following example for you: Example. It demonstrates how to embed the IBM Plex Sans Arabic font (the Regular & Bold variations) to a survey PDF. This font contain glyphs for Arabic and English letters so you can ensure that your multi-language survey appears correctly in PDF:
Clipboard-File-1.png

Please follow the Change the document font for more information on how to create a custom font-family and render PDF surveys using a custom font.

See also: Online Example: Custom font family.

Please let me know if you have any questions or require further assistance.

Thank you,
Jane
SurveyJS Team

    Comments (2)
    T T
    Taher EL-Shafei 2 years ago

      It's working now thanks but I think you should add this at the documentation

        You're always welcome, Taher!

        Thank you for your valuable suggestion. We strive at making our documentation super helpful. Let me quickly note that the Change the document font help topic explains in details what steps need to be done to handle this case. Or, does this topic miss anything important? Please let me know.