Free Support Forum - aspose.com

Shape height cannot be greater than 1584 points

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,


Thanks for your inquiry. Please note that Aspose.Words tries to mimic the same behavior as MS Word do. The measurement for images must be between 0 and 55.88 cm (55.88 cm = 1584 points). Please see the attached images for detail. Please do not set the image size more then 1584 points.

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 for your inquiry. Please note that Aspose.Words tries to mimic the same behavior as MS Word do. Due the limitations of MS Word (shared in my previous post), you can not insert such image (with size greater than 55.88cm) into Doc/Docx by using MS Word and convert the document to Pdf.

By using Aspose.Words, you can load the file formats mentioned here into Aspose.Words’ DOM (Document Object Model) and convert the loaded document to Pdf. Your image size is greater than 55.88cm (height/width) so you can not insert this image into following file formats by using Aspose.Words and MS Word.
http://www.aspose.com/docs/display/wordsjava/LoadFormat

However, you can insert such big images into PDF file by using our product Aspose.Pdf. Please post your query at Aspose.Pdf forum.

Hope this answers your query. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

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,


Please accept my apologies for late response.

Thanks for your inquiry. As I shared with you earlier that Aspose.Words tries to mimic the same behavior as MS Word do. Due the limitations of MS Word (shared in my previous post), you can not insert such image (with size greater than 55.88cm) into Doc/Docx by using MS Word and convert the document to Pdf.

I have discussed the insertion of EMF issue in Pdf with our Aspose.Pdf team. I like to share with you that Aspose.Pdf for .NET supports the insertion of EMF file into Pdf. Howerver, they are planning to add this feature in Aspose.Pdf for Java. Hopefully, this feature will be available in future releases. If you have any query about this issue, please post your query at Aspose.Pdf forum.

While setting the page height/width more than limited size (the measurement for images must be between 0 and 55.88 cm), the exception is not thrown. I have logged this issue as WORDSNET-8157 in our issue tracking system. Our development team will look into this issue and we will update you via this forum thread about the details of this issue.

We apologize for your inconvenience.

Dear ASPOSE TEAM,


Thank you for your support. However, could you please tell us if this feature has been added to the new release. We are trying to render a big image to a doc and pdf formats and the page size is A0 and A1. But we always get the following exception:

Shape height cannot be greater than 1584 points


Hi there,


Thanks
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.


Is there any size limit of the image. Because when I am rendering the image on an A0 size page, I can see the above mentioned message i.e. (Shape height cannot be greater than 1584 points.) ?

Basically, we would like to render the image on an A0 size page (i.e. 841 x 1189 mm).


FYI: I did a quick test with your code.

But for some reason it doesn’t go beyond the following lines:


// Load images from the disk using the approriate reader.
// The file formats that can be loaded depends on the image readers
// available on the machine.
final ImageInputStream iis = ImageIO.createImageInputStream(new File(inputFileName));
final ImageReader reader = ImageIO.getImageReaders(iis).next();
reader.setInput(iis, false);

Is there something that is missing in the code.

Hi there,


Thanks
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.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.