You’ll easily find the target line on the right top; “The Saga labor bureau labor standard part (the director department)” which I prefer to be wrapped inside the box.
I did search this forum and read some 50-ish topics, including this but I’m not quite sure how to do it.
I read this and included the log file in the above zip archive for more information.
I’m using Aspose.Pdf for .NET ver 18.5.0.
Thank you for your team’s support.
We would like to request you to use below code snippet in your environment and then share your kind feedback with us. It replaces the text without overlapping the boundary of the rectangle.
Document doc = new Document(dataDir + "2017112144212.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(@"佐賀労働局労働基準部(監督課)");
textFragmentAbsorber.TextReplaceOptions.ReplaceAdjustmentAction = TextReplaceOptions.ReplaceAdjustment.WholeWordsHyphenation;
doc.Pages.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
{
textFragment.Text = @"The Saga labor bureau labor standard part (the director department)";
}
doc.Save(dataDir + "Test_18.5.pdf");
We have attached generated PDF file for your kind reference Test_18.5.pdf. We hope this will be helpful. Please feel free to contact us if you need any further assistance.
Thank you very much for teaching me the option effective to my issue.
However this doesn’t suffice.
I’d like no text in the page to run over on the right side.
Please find the attached file. All the lines are running over to the right. 2017112144212_jaen_out_suggestedOptionSet.pdf (260.4 KB)
I did customize 2 lines in your snippet as follows.
// TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(@"佐賀労働局労働基準部(監督課)");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(".+");
// textFragment.Text = @"The Saga labor bureau labor standard part (the director department)";
textFragment.Text = textTranslator.doTranslation(textFragment.Text.ToString());
I’d like to “translate” the PDF.
Now I realized I failed to put the important link to my own snippet and my scenario.
I am truly sorry not letting you know what my intention is like.
I understand the option “TextReplaceOptions.ReplaceAdjustment.WholeWordsHyphenation” is effective in some cases.
Would you kindly advise me if there is another tips fully effective for my scenario?
Thanks again.
We have tested the scenario and have been able to notice the problem of text overflow. A ticket with ID PDFNET-44812 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.
The logged ticket is pending for investigations owing to previously logged issues in the queue. We have recorded your request for ETA and will update you as soon as some information will be available. Since this ticket is currently logged under free support model, the resolution can take several months. Whereas, tickets logged under Paid Support are resolved earlier because of more priority.
In case you are not already subscribed to Paid Support, you may please consider subscribing for it. For further information, please visit Paid Support FAQs.