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

Free Support Forum - aspose.com

Count of Original Document's Pages

Hello,
I’m writing you because I was a little confused by ‘improving calculation of pages’ for new release 15.4.0

The deal is that:
After absent font substitution size of text is changed.
We controlled it comparing count of pages original document and document after the substitutions. (Additionally we compared y-point of last character : layoutEnumerator.getRectangle().getY():wink: and then set new size for text.
But now I don’t know how do it. Because document.getPageCount() returns count of pages after substitution, not original one.
I tried to use layoutCollector.getStartPageIndex(docOut) and layoutCollector.getEndPageIndex(docOut) but with the same result.

Could you please to help me how to know sizes of original document now?
Or may be aspose team will return possibility to know it through getPageCount()? And PageCount of final document could be returned after updatePageLayout, for example. Is it possible?

Best Regards

Hi Akane,


Thanks for your inquiry. There is no ‘Page’ concept in Microsoft Word documents. Pages are created by Microsoft Word on the fly. You should use getPageCount. Do you see different number of Pages in Aspose.Words generated Pdf files (with and without fonts installed)? If yes, then getPageCount should match the number of Pages shown in Pdf files because this property uses the same routines as layout engine which is responsible for generating Pdf files. Please make sure that the required fonts are installed on your machine:
http://www.aspose.com/docs/display/wordsjava/How+Aspose.Words+Uses+True+Type+Fonts

Best regards,

Hello,
Thank you for your reply but I’m already able to get required information just use:
document.getBuiltInDocumentProperties().getPages()

Unfortunately I still can’t find way to get how size of text is changed after font substitution.
Before I used bookmarks which covered the whole text and compared sizes of rectangles:
Object renderObject = layoutCollector.getEntity(bookmark.getBookmarkEnd());
layoutEnumerator.setCurrent(renderObject);
fc.setSizeY(layoutEnumerator.getRectangle().getY()

But it allows to get sizes only fields after font substitution, not before. Because the missing fonts are substituted when layoutEnumerator is created.

So it would be wonderful if there is some way to know how to control resizing of text fields during missed fonts substitution process.
To be clear I give you example:
We have document created on one PC-1 with fontA. There is no fontA installed on another PC-2.
We convert the document to set of *.png files on PC-2.
Since fontA could not be found on PC-2 the font is substituted by another one. But size of text is changed according on different properties of fonts. Sometimes even count of pages is changed. How we can control it? May be manually set of font size? But then which size should be set? The main problem is that we don’t know original sizes.

Please understand that I don’t require aspose team to provide me some tool to control size changes immediately. But it would be wonderful if you just think of this possibility in future.

Anyway thank you for your work.
Best Regards

Hi Akane,


Thanks for the details. Please attach your Word document and Font here for testing. We will reproduce and investigate the scenario on our end and provide you more information.

Best regards,

If it will be useful…
“Floverchild” is original font, (http://www.fontriver.com/font/flowerchild/)
“Trebuchet” is substituting font.

Original document: 3 pages.
Result: 2 pages

Actually I tested it like:
create document with text on n pages using some fontA that is exist on PC-2 as well.
try to change font to get different count of pages (only font, not size!) using only fonts that are NOT exist on PC-2.
save document on PC-1 and try to convert on PC-2 being sure that fontA is set as default

Best Regards,
Akane

Hi Akane,


Thanks for the additional information. Well, content can grow or shrink depending on the font it is formatted with. On my side, MS Word 2013 displays 3 pages without ‘Flowerchild’ font and 2 pages when ‘Flowerchild’ is installed. Also, when formatting the content with ‘Times New Roman’ using MS Word, it fits the content within 2 pages. In this case, Aspose.Words mimics the behavior of MS Word 2013. So, this is the expected behavior. If we can help you with anything else, please feel free to ask.

Best regards,

Hello,
Thank you for your attention. I totally understand why resizing occurs.
We just would like to control it.
But if it impossible, we understand.

By the way, could you please so kind to check one little detail?
I’ve created a doc with 32 line of text. Then the doc was converted and during the process I called commands:
docOut.getBuiltInDocumentProperties().getPages(); //(after uploading the document, so there is 1)
docOut.getBuiltInDocumentProperties().getLines(); //(next command and there is 32)
…//font substitution…
docOut.updatePageLayout();
docOut.getBuiltInDocumentProperties().getPages(); //(updated value, 2)
docOut.getBuiltInDocumentProperties().getLines(); //(STILL 32!!!) Even if I performed the same actions in MS Word I get 2 pages with 68 lines)
I suppose that count of lines is not updated. If it is not bug could you please to say when this value is updated for new applied fonts?

Could you please check it?
(And sorry for all this question, we are just looking for how to subdue resizing trying all possible ways.
Best Regards,
Akane

Hi Akane,


Thanks for your inquiry. The BuiltInDocumentProperties.Lines property represents an estimate of the number of lines in the document. Aspose.Words does not update this property. It just retrieves information from the built-in document properties. MS Word 2013 tells that there are 50 lines in your ‘JhfkuP.docx’ document but this property returns 32. For the sake of any corrections, I have logged this problem in our issue tracking system as WORDSNET-11953. Our product 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,

The issues you have found earlier (filed as WORDSNET-11953) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.