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

Free Support Forum - aspose.com

Problem in text selection in rendered PDF

Hi,
We have been using Aspose to save a docx file as a pdf using pdf save options, but have been facing some issue when it is rendered to a HTML 5 canvas. The problem faced is that when we try to select some text on the browser, then the selection is not contiguous, i.e., it is broken up wherever there is whitespace. However, when we use a normal pdf that has been saved through a manual save operation in word, then the selection is how we expect it to be. Could you please let us know why the PdfSaveOption is making this pdf behave in this fashion? We’re using firefox to open the pdf generated. Attaching a screen-shot of the same for your reference.

Hi Praneeth,


Thanks for your inquiry. Please attach the following resources here for testing:

  1. Your sample Word document.
  2. Aspose.Words generated output PDF document
  3. Code you used to generate this PDF on your end.

We will investigate the issue on our end and provide you more information.

Best regards,

Hey Awais,

I'm attaching a zip file containing the Word document, the Aspose generated pdf document and the pdf document generated when I saved it via Word. The code for conversion is as follows:

Document doc = new Document("../sampleDoc.docx");

PdfSaveOptions option = new PdfSaveOptions();
option.getOutlineOptions().setDefaultBookmarksOutlineLevel(9);

doc.save("../AsposeSampleDoc.pdf", option);

Hi Praneeth,


Thanks for your inquiry. I tested the scenario and have managed to reproduce the same problem on my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-9880. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,
Hi Praneeth,

Regarding WORDSNET-9880, our development team has completed the work on your issue and has come to a conclusion that this issue and the undesired behaviour you're observing in web browser(s) is actually not a bug. So, we have closed this issue as 'Not a Bug'.

Please note that Aspose.Words uses its own layout engine during rendering Word document to PDF; in this case, there's a difference in the way Microsoft Word produces PDF output and Aspose.Words way of processing PDFs. We think, this behaviour is a bug of the browser hosted viewer since neither Foxit Reader nor original desktop Adobe Pdf Reader reproduce it.

Best regards,

Hey Awais,
I know this sounds odd, but is there any way for Aspose to mimic the way Microsoft Word produces PDF, w/o any additonal functionality that may be added on due to the different way of rendering PDF files? I just ask since this behaviour is exhibited by all standard browsers. Thanks.

Hi Praneeth,


Thanks for your inquiry. Aspose.Words draws each glyph separately, but Microsoft Word draws each line separately. Besides Microsoft Word calculates position of every glyph and corrects it if needed. Unfortunately, with current architecture, we don’t know how Aspose.Words can follow this behavior of Microsoft Word for now. We apologize for any inconvenience.

Best regards,