Free Support Forum - aspose.cloud

Replace Text in PDF in C# using Aspose.PDF REST API charged or not?

I’m using the cloud platform together with the .NET SDK.

Here’s my code:
Product.BaseProductUri = “http://api.aspose.com/v1.1”;
var folder = new Folder();
folder.UploadFile(“test1.pdf”, “”);

var textEditor = new TextEditor(“test1.pdf”);
var textItems = textEditor.GetTextItems();

foreach (var textItem in textItems)
{
System.Console.WriteLine("textItem: " + textItem.Text);
var newText = textItem.Text;
newText = newText.Replace(“Old text”, “New Text”);
textEditor.ReplaceText(textItem.Text, newText, false);
}

Now according to my log I’m charged for the ReplaceText, even though the documentation on https://purchase.aspose.cloud/pricing says:
When you work with documents, many API calls, for example uploading a document, replacing text or merging documents, are free.

Can anyone confirm what is considered an operation and not? I’m looking at doing around 10 replaces per PDF document I work on. Money-wise on a basic plan, that means $1.5 per doc.

Regards

’Hans Olav.

I just tested the ReplaceTextList and seems you can batch up replace texts and only pay for 1 operation.


This method wasn’t included in the .NET SDK, so I had to put it in myself.

Hi Hans,

Good to know that you have started using ReplaceTextList resource to replace text in one operation instead of calling replaceText in a loop.

Replacing text is a free operation. Can you please share the email ID registered with your account? We will investigate in detail if you are charged for replacing text.

Best Regards,

Hi. My account is set up with the email: hans.olav@linkmobility.com.

I would really like to better understand how I’m charged.

My usage pattern will be this:
  1. Upload pdf template document
  2. Replace texts
  3. Download pdf
  4. Delete pdf.

Cheers

’Hans Olav.

Hi Hans,

We are investigating the issue and will update you soon.

Best Regards,

Hi Hans,

You have been charged for monthly charges of your plan only. You have not used any additional operations so nothing has been charged for additional operations. Your current usage is 23/750 so you are far behind your monthly allowance. Replace text operations are free and we are not charging anything for these operations.

Please let us know if something is still not clear and lead you to the impression that we are charging for replace text.

Best Regards,

You misunderstand my question. It seems that every time I execute a ReplaceText operation on a document, my document operations counter bumps up 1 point.


So how does this work? If I do 10 replace operations on one document, does that eat away 10 document operation points from my count?

How does this work? Your log clearly says I’m “charged” 1 document operation when I execute ReplaceText. So either your documentation is incorrect/unclear or your logs are.

Hi Hans,

This should increase zero operations because it is not a document API. Can you please share your logs for the current period? You can follow https://docs.aspose.cloud/display/storagecloud/Get+APIs+Usage+Statistics+for+the+Current+Month to generate a log file.

If you are talking about the logs at https://dashboard.aspose.cloud/#/usage or anything else in our GUI, please share a screenshot of the screen where it is mentioned that you are charged for replace text or replace text has increased your used operations.

Best Regards,

See attached log file.

Hi Hans,

Thanks for the logs. We are investigating it and will update you soon.

Best Regards,

Hi Hans,

The issue is resolved. Please test at your end and let us know if you are still charged for replace text.

Best Regards,

Hi. Seems like the issue is resolved now. Thanks!

@HansOlav

As an update, please note, Each api call consumes a credit. So if you call PostDocumentTextReplace API method 10 times it will charge you 10 credits. Secondly the API provides a list parameter for text replacement, so you can replace multiple strings in one API call.