With latest Aspose Words Java Release
/////////////////////////////////////////////////////////////////////
Document document = new Document(“text.docx”);
document.getFirstSection().getPageSetup().setPageWidth(ConvertUtil.inchToPoint(100));
document.getFirstSection().getPageSetup().setPageWidth(ConvertUtil.inchToPoint(100));
final DocumentBuilder docxBuilder = new DocumentBuilder(document);
final Shape image = docxBuilder.insertImage(“image.gif”);
image.setHeight(ConvertUtil.inchToPoint(50));
image.setWidth(ConvertUtil.inchToPoint(50));
document.save(“result.pdf”);
//////////////////////////////////////////////////////////////
The error exception is “Shape height cannot be greater than 1584 points”.
Does that mean the height of any image or shape cannot be larger than 1584 points?
Is there any workaround on the issue?
Thanks
Hi there,
Hope this answers your query. Please let us know if you have any more queries.
Thanks for reply.
We’re using Aspose words java library to produce PDF files.
It seems that the library has no problem to set output PDF’s size larger than the MS Words max 22 inches.
I fully understand inserted image’s size should not be larger than the max 22 inches if the output is doc or docx, but inserted image size should have no such size limitation for PDF output, otherwise, the library has limited usage for my company.
Hi there,
Thanks.
There are couple things:
(1) If APIs can set up any page size without exception, it doesn’t make sense to throw exception when setting up a shape size.
//no exception
document.getFirstSection().getPageSetup().setPageHeight(ConvertUtil.inchToPoint(100));
(2) Aspose pdf doesn’t support EMF images.
We’ve used Aspose words java for many years to produce docx or pdf with EMF images. Recently our customers want to have a very large size pdf with large sized EMF images for engineering printing purpose. We got the issue “Shape height cannot be greater than 1584 points”. Could you make a hot fix for us to remove the shape size exception? otherwise, we’ve to switch to a different java pdf library.
Hi there,
Dear ASPOSE TEAM,
Hi there,
for your inquiry. The issue reported in this forum thread is that the exception is not thrown while setting the page height/width more than limited size (the measurement for images must be between 0 and 55.88 cm).
I suggest you please check the second code example (converts large size image into a PDF document) from here:
http://www.aspose.com/docs/display/wordsjava/How+to++Convert+an+Image+to+PDF
Hope this helps you. If you still face issue, please share your input document, images along with runnable Java application for investigation purposes.
Thanks for the quick response.
FYI: I did a quick test with your code.
Hi there,
for your inquiry. Have you checked the CalculateImageSize method from following documentation link?
http://www.aspose.com/docs/display/wordsjava/How+to++Convert+an+Image+to+PDF
It would be great if you please share following detail for investigation purposes.
- Please attach your input Word document and images.
- Please attach the output Word file that shows the undesired behavior.
- Please
attach your target Word document showing the desired behavior. You can
use Microsoft Word to create your target Word document. I will
investigate as to how you are expecting your final document be generated
like.
us we’ll start our investigation into your issue.