Converting to Pdf is giving Wrong Conversion

Hello Team,

I am merging the field using below mention code in the document editor


insertField(fieldNamestringcaptionNamestring) {
        let fileName = fieldName.replace(/\n/g'').replace(/\r/g'').replace(/\r\n/g'');
        var fieldCode = 'MERGEFIELD  ' + fileName + "   MERGEFORMAT ";
        this.documentContainer.documentEditor.editor.insertField(fieldCode'«' + fieldName + '»');
        this.documentContainer.documentEditor.focusIn();
    }


After merging the document with this preview is right but when we convert this json to pdf a single field is wrongly converted. Error Json and Snapshot attached.


Angular Code:

 documentContainer.documentEditor.saveAsBlob('Docx').then(function (exportedDocument) {
      // The blob can be processed further
      var formData = new FormData();
      formData.append('data'JSON.stringify(obj.data));
      formData.append('file'exportedDocument);
      var httpRequest = new XMLHttpRequest();
      httpRequest.open('POST'obj.baseUrl + 'FileUpload/docToPDF'true);
      let flag = false;
      httpRequest.onreadystatechange = function (e) {
        if (!flag && httpRequest.status === 200) {
          flag = true;
          const filePath = httpRequest.getResponseHeader("x-filepath");
          window.open(filePath);
        } else {
          //alert('Fail to save the document');
        }
      }
      httpRequest.withCredentials = true;
      httpRequest.send(formData)
    });



C# Code : 

Syncfusion.DocIO.DLS.WordDocument wordDocument = new Syncfusion.DocIO.DLS.WordDocument(file.InputStream, Syncfusion.DocIO.FormatType.Docx);
Syncfusion.DocToPDFConverter.DocToPDFConverter pdf = new Syncfusion.DocToPDFConverter.DocToPDFConverter();
PdfDocument pdfDocument = pdf.ConvertToPDF(wordDocument);
FileStream fileStream = new FileStream(_savelocation, FileMode.OpenOrCreate, FileAccess.ReadWrite);
pdfDocument.Save(fileStream);
pdf.Dispose();
wordDocument.Dispose();
pdfDocument.Dispose();




Attachment: LetterError_20032021_d31b9512.zip

12 Replies 1 reply marked as answer

SM Suriya Murugan Syncfusion Team March 22, 2021 09:33 AM UTC

Hi Nagendra, 

Syncfusion Greetings! 

We have validated the provided JSON. In sfdt, Field end is missing for mentioned case , so field code is visible. Can you please share details about how you generated that sfdt and have modifed sfdt data? Please share the requested details. That will helpful for us to proceed further and provide you solution at earliest. 
Field type 1 is missing: 

 
Regards, 
Suriya M. 



NG Nagendra Gupta March 22, 2021 09:44 AM UTC

Hello,

Thanks for your reply.

User is creating the same with the custom merge option. 

Please check the below mention working link

http://test.cboinfotech.co.in/erp/rd?url=masters/LetterEdit&paid=1041&code=DEMOTEST&LAT_LONG=&brand=web&rtick=637520121379946541&FY_YEAR=2020-2021&MENU_STYLE=NONE&DOC_TYPE=LAYOUT&DOC_ID=2083


Click on the Merge Field Option on Top Left Side, select the area where you want to insert to merge field then click on the merge field to insert.




NG Nagendra Gupta March 22, 2021 11:34 AM UTC

Hello,

If in any case user input the wrong field. Is there any possibility to remove this kind of error by angular or c# code?

I mean how to remove these kind of invalid inputs


SM Suriya Murugan Syncfusion Team March 23, 2021 09:13 AM UTC

Hi Nagendra, 

We have tried to reproduce the reported issue in provided link by inserting new merge field but couldn’t. No, possible way to identify this type of issue. We suspect the issue is after insert field, any changes made in sfdt data or editing level it gets affected. Can you please recreate the Sfdt from original document (word document) and check whether issue reproduced? If yes, please share the steps. That will helpful for us to proceed further. 

Regards, 
Suriya M. 



NG Nagendra Gupta March 31, 2021 11:36 AM UTC

Hello Suriya ,

Thanks for your kind update.

Steps to reproduce the error with the following link:

http://test.cboinfotech.co.in/erp/rd?url=masters/LetterEdit&paid=1041&code=DEMOTEST&LAT_LONG=&brand=web&rtick=637520121379946541&FY_YEAR=2020-2021&MENU_STYLE=NONE&DOC_TYPE=LAYOUT&DOC_ID=2083


Step 1: Insert Any Merge Field From the Merge Field Menu Top Left side to the Toolbar
Step 2: Click with Mouse at the Left Tip of the Merge Field   (Above "«" this), once you clicked on this same focus will move before the Merge field.
Step 3: Now type any word,
Step 4: After Typing any word, move your cursor after the merge field
Step 5: Press the Backspace button, after pressing backspace your merge field will be selected.


Thanks,



 



Attachment: LetterError_MergeFieldExtend_30022021_beba36a8.zip


SM Suriya Murugan Syncfusion Team April 1, 2021 08:33 AM UTC

Hi Nagendra, 


Thanks for sharing the details. 

Can you please confirm this is the issue which you reported? 

 

Text inserted also considered as field display text. 


Regards, 
Suriya M. 



NG Nagendra Gupta April 7, 2021 05:25 AM UTC

Yes this is the same issue i am facing. 


SM Suriya Murugan Syncfusion Team April 8, 2021 07:35 AM UTC

Hi Nagendra, 

We will check this case and update further details by April 12,2021. 

Regards, 
Suriya M. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team April 12, 2021 05:21 PM UTC

Hi Nagendra,  

Currently, we are validating the reported issue. we need additional timeline to check this. we will update further details by April 14,2021.  

Regards,  
Kurthis Banu A.  



SM Suriya Murugan Syncfusion Team April 14, 2021 11:21 AM UTC

Hi Nagendra, 

Can you please check this issue with latest release version(19.1.0.56)? We have checked the same issue in latest version. It is proper. 

Please let us know if still exists. 

Regards, 
Suriya M. 




NG Nagendra Gupta April 16, 2021 05:17 AM UTC

Hi Suriya,

Thanks for your update, where is the insert merge field option in your given example. Please mention the steps on how to check the merge field option in your given example.


SM Suriya Murugan Syncfusion Team April 19, 2021 07:39 AM UTC

Hi Nagendra, 


You can insert merge field by clicking the field “Select the field to insert” pane or use “Insert field” options in toolbar. 

Please let us know if you have any questions. 

Regards, 
Suriya M. 


Marked as answer
Loader.
Up arrow icon