We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF Overlapping Issue

Hi Team,

I am successfully able to convert PDF to HTML with perfect style and formatting.

After conversion of HTML …I am replacing some text in HTML. and regenerating from HTML to PDF
but replaced text is overlapping next text within it…
is that possible something like word wrap or line break automatically…

Or some properties I need to consider at the time of HTML Conversion?

for you reference I am attaching one html converted from pdf…

OverlappingText.zip (35.2 KB)

@kotharib2

Thank you for contacting support.

Would you please share source PDF file along with narrowed down code snippet so that we may try to reproduce and investigate it in our environment.

Hi @Farhan.Raza

This is the code and HTMLSaveOptions I am using for HTML Conversion…

Aspose.Pdf.HtmlSaveOptions options = new Aspose.Pdf.HtmlSaveOptions();
options.PartsEmbeddingMode = Aspose.Pdf.HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
options.RasterImagesSavingMode = Aspose.Pdf.HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
//options.LettersPositioningMethod = Aspose.Pdf.HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
String htmlfile = Path.Combine(Path.Combine(Root, folder), folderName + “.html”);
pdf.Save(htmlfile, options);

Please find PDF file attached…Overlapping Text.zip (48.5 KB)

@kotharib2

Shared data generates a HTML file which looks fine, as mentioned by you. Please elaborate how are you replacing text in HTML, share respective code so that we may proceed further to help you out.

We’re just replacing the text node,
TextNode.replaceWith(newTextNode)

@kotharib2

We are afraid Aspose.PDF for .NET API does not include the class TextNode. Would you please share a narrowed down sample application reproducing the issue so that we may proceed to assist you efficiently.

@Farhan.Raza
Hi Farhan

I mean, I am editing raw html and then regenerating pdf back from edited html…
replacement of only text is done…rest we are not touching any tags.
So, When I replace a word which is more then original word length…I want that word should move to next line…

as If you see HTML all lines of paragraph of pdf are in individual div.
and each div contains absolute top and left parameter…

So, I want to make that top and left responsive.

@kotharib2

Thank you for elaborating it further.

We have generated the HTML file by converting shared PDF document. However, we need the edited HTML file, as a ZIP format file, so that we may try to convert it to PDF for reproducing the problem in our environment.

Hi @Farhan.Raza

I already sent edited HTML in first question…
There If you see that HTML, you will find text is overlapped with next column data …

@kotharib2

We have converted that HTML file to PDF file and rendered PDF file looks exactly as the browser displays the HTML file. Please share if you notice any difference between HTML and PDF files. OverlappingText_18.10.pdf (119.3 KB)

@Farhan.Raza

Generation of PDF to HTML and Regeneration of PDF from same HTML is perfect.
Issue is after converting pdf into html…
assume in Html there is one (3 letter )word [XYZ] and I replaced that word from raw html into (huge number of letters) like [MISSISSIPI]…

This Long replaced Word is overlapping with text in next coloumn as you can see in HTML which I shared…

So, I want is HTML should go to next line and not overlap with exsiting line.

@Farhan.Raza

If you notice HTML created from PDF
Each line of paragraph is a <div> with fix top and left parameter(css style)
Can anything be done at the time of conversion logic…to make it responsive…
Any help can I get from CustomCssStrategy method of Aspose.Pdf?

Each line of a paragraph is div with top and left parameter as fix.

@kotharib2

We are afraid no property may be changed at the time of conversion. However, an investigation ticket with ID PDFNET-45521 has been logged in our issue management system for further investigations. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.