Free Support Forum - aspose.com

Aspose pdf word wrap function missing!

I want to do wordwraping according to this post:

http://www.aspose.com/docs/display/pdfkit_removed/Setting+Wordwrap+while+replacing+text+and+using+ReplaceTextStrategy+class

The code:
pdfEditor.getReplaceTextStrategy().setTextNotFitAction(ReplaceTextStrategy.Action.WORDWRAP);

BUT, when coding I can’t find ReplaceTextStrategy.Action.WORDWRAP anywhere!

I’ve tried both java/net version, from current 10.3 version to older pdf.kit in 2012. Just can’t find WORDWRAP.

Is it missing or deprecated? Or I didn’t do it right?

All I want is to replace the orginal PDF text with the new one, and meantime make the new PDF similar to the old one without breaking the lines. I’m evaluating ASPOSE PDF for future produciton ,and I feel wordwrap should be a guaranteed feature.

If you have any solution or alternative ways, please reply ASAP. Thank you!

Hi there,


Thanks for your inquiry. Please note Aspose.Pdf kit for Java has been merged into Aspose.Pdf for Java. Its all classes are moved into com.aspose.pdf.facades package. To wrap text after replacement, please use AdjustSpaceWidth value of TextReplaceOptions.ReplaceAdjustment property as following. It will help you to accomplish the requirement.

pdfEditor.getTextReplaceOptions().setReplaceScope(TextReplaceOptions.Scope.REPLACE_ALL);<o:p></o:p>

pdfEditor.getTextReplaceOptions().setReplaceAdjustmentAction(TextReplaceOptions.ReplaceAdjustment.AdjustSpaceWidth);





Please feel free to contact us for any further assistance.

Best Regards,

Thank you for reply! I’ll try your code.


BTW, is this the same method in the .NET version?

Hi,


Aspose.Pdf for Java is an auto-ported version of Aspose.Pdf for .NET, so all the features currently available in Aspose.Pdf for Java are also present in its .NET sibling. Please take a look over following code snippet.

[C#]

PdfContentEditor pdfEditor = new PdfContentEditor();<o:p></o:p>

pdfEditor.BindPdf("input.pdf");

pdfEditor.TextReplaceOptions = new TextReplaceOptions( TextReplaceOptions.Scope.REPLACE_ALL);

pdfEditor.TextReplaceOptions.ReplaceAdjustmentAction = TextReplaceOptions.ReplaceAdjustment.AdjustSpaceWidth;

pdfEditor.Save(“resultant.pdf”);


Thank you.


I found that the search/replace process seem to be fairly slow.

The PDF have 10 pages and I limit the replacing range to be page 1. Replacing 1 word consumes 5 seconds. A sentence of 10 words can be up to 15 seconds.

Any way to speed it up?

Hi there,


Thanks for your feedback. Normally processing time is depends upon the file size/contents and system resources. We will appreciate it if you please share your sample document and text strings, to be searched and replaced. We will look into it and will guide you accordingly.

Best Regards,

I tried .net code, but didn’t work. Is something wrong with my code?


The attachment include test pdf file and some of the code.

Can you help me with it?

Hi,


Thanks for sharing the resource files.

I
have tested the scenario and I am able to reproduce the same problem that word wrap is not being honored during text replace. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-38759. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

Hi

Any update for ticket PDFNEWNET-38759 ?

@vunguyen

Thank you for contacting support.

We would like to update you that, tentative release to include the fix for PDFNET-38759, formerly PDFNEWNET-38759, is Aspose.PDF for .NET 18.12; which is expected to be released in December 2018. We will notify you as soon as the ticket will be resolved. We appreciate your patience and comprehension in this regard.

The issues you have found earlier (filed as PDFNET-38759) have been fixed in Aspose.PDF for .NET 19.3.