Generate PDF issue in Aspose.PDF for Java

Hello ,

I need your help please for this bug that we found in our project java to generate PDF document :

A placeholder is set to CAPITALS by itself, even though the variable has changed to lowercase and in the template there is no style applied to the placeholder.

Could you help please !
Don’t hesitate if you need more informations about the issue !

Thanks!

@MDAKNOU

Would you please explain a bit more by sharing your sample file and the code snippet that you are using? We will test the scenario in our environment and address it accordingly.

Hello Ali ,

Thanks for your reply .
Will share with you some of codes that we uses to generate our pdf :
1st step :we get the template id ,then we pass it + fields inside the payload of the endpoint generate ({{url}}/documents/generate) , you can fin below the payload we use :

{
    "templateId": "{{templateId}}",
    "fields": [
        {
          "fieldName": "DOC_TITLE",
          "fieldValue": "TEST"
        },
        {
          "fieldName": "LABEL_CONFIDENTIAL",
          "fieldValue": "TEST"
        } 
]
}

@MDAKNOU

Please confirm you are using Aspose.PDF for Java or Aspose.PDF Cloud SDK for Java in your project and also share your sample code to reproduce the issue for investigation.

Hello ,
We use Aspose.PDF for Java

@MDAKNOU

In that case, would you kindly provide the backend code snippet that you are using to probably replace the text? Your initially shared code snippet looks like some request body. Please share enough information that we can use to replicate the issue. Also, please provide sample document as well.

Hello ,

The main code in our controller is that :

1st step: we get our template id that we pass in our request body
Second step : we load the template
Third step : we fill placeholders

The step of Fill Placeholders:

@MDAKNOU

Looks like you are using MailMerge feature of Aspose.Words. Are you editing a Word template and generating output as PDF? Also, in your code snippet, we could not find any Aspose API related code. Please provide the original code where you are using Aspose API to generate the output along with the sample source template file. We will further proceed to assist you accordingly.

Hello,

Yes we are editing a word template with our fieldNames and fieldValues passed in the request body of our endpoint generate and the result (the output ) is a PDF.

Here we load our template :

@MDAKNOU Could you please attach your template, output and expected output documents here for our reference? We will check the issue and provide you more information.

hello ,

thanks for your reply!

The payload of the request

The issue is with the field field “BUYER_ADDRESS_LINE_2” , pass to uppercase without reason .

@MDAKNOU First of all data in your data source is all caps:

"fieldName": "BUYER_ADDRESS_LINE2",
"fieldValue": "88120     TUHKAKYLÄ"

Also in your template field is formatted with All Caps:

Ah my bad , i sent you the wrong payload , this is the right one :

@MDAKNOU In your template field BUYER_ADDRESS_LINE2 is formatted with All Caps as I have mentioned in my previous answer. So the value inserted into the merge field is also formatted as All Caps. So to get the expected output you should reset this flag.

Ohhh yeah got it!

Thanks a lot i see your point of view :slight_smile:

1 Like