is there a way to convert a range of a POI sheet to image (any extension) ?
Is there an library that can help me do that (beside aspose) ?
Thank you so much
Aspose.Cells can convert your Range into Image. Please see the following article for sample code. The code first sets the print area to your desired range. For example, in the article, it is setting print area to E18:H15. You can also set print area manually with Microsoft Excel. After setting print area, it takes the image of entire worksheet using the options.OnePagePerSheet = true statement. But entire worksheet will not be printed in the image and only the range E18:H15 will be printed in the image, hence your purpose is achieved.
Please note, if you do not set the print area and OnePagePerSheet is true, then you will get the image of entire worksheet. And if OnePagePerSheet is false, then you will get as number of images as there are number of pages inside the worksheet.
Article Link:
Export Range of Cells in a Worksheet to Image
Note: I am working as Developer Evangelist at Aspose
Related
I need to get x,y ,width and height of a given word in pdf. so that later while parsing the same type of file i can fetch value from the co-ordinate itself. How should i get position of a word from PDF using java.
Rectangle rect = new Rectangle(451, 125,100,1); // i need to get this co-ordate for any particular word
stripper.addRegion("class1", rect);
stripper.extractRegions(pdDocument.getPage(0));
System.out.println("stripper "+stripper.getTextForRegion("class1").trim());
I think that you could make use of Apache's PDFBox API and follow the advice in this similar question which is specific to that API to write the code you need.
I am trying to have a chart that only fills a certain amount of points using mpandroid chart, I have looked at the wiki but I am directed to a 404 error when I try to look at the default fill formatter. The picture has all of the values filled. Any help will be appreciated, thanks.
Nevermind, I got it, the key here is to make multiple data sets with overlapping x indices and each dataset will have a point that doesn't overlap with the previous data set. Then specify which data set to setdrawfill(true/false).
I'm trying to print an existing PDF.
I already tried this: java pdfbox printerjob wrong scaling / page format
PDFBox is not working for me, because I can't get the right scaling of my PDF.
Scaling.SHRINK_TO_FIT is almost working but it's missing about 5mm and I can't add them because paper.setImageableArea is resetting it.
Also I tried to use new Paper(); with own margins and without setSize, because I can't get the size of an DIN A4 paper. The problem with the margins is, if I'm getting the correct top & left size and then try to set the height and width then it's destroying the top & left position.
Now I'm looking for a free and simple solution without PDFBox to print a pdf file without losing the quality and the scaling.
It's kinda silly but here is already the solution: https://stackoverflow.com/a/35483083/4888475
My printed page was equal to the printed page from the Acrobat software and not to Firefox.
I'm calling Fedex API to generate a shipping label. The API returns a byte array. I then write this byte array to a pdf using:
Files.write(Paths.get("xyz.pdf"), imgBytes); //imgBytes is the response I get from Fedex API
However, when I open the file, I see that the actual label occupies only about 2/3rd by width and 1/2 by height of the entire pdf because of which I'm having a lot of white space in the PDF.
Is it possible to somehow remove this white-space using PDFBox? Or is it possible to remove the white-space while saving the byte array to the pdf file?
Thanks.
I am writing a program that would validate PDF file. I am using iText java library to get content of a file, but I have some problems with parsing it. I need to get info about color space and DPI of each image. How can I get info about position and dimensions of image in PDF? I tried to browse each XObject of PDF but I stuck, I cannot find any information about width and height of file in PDF.
Are there any other libraries which can help me?
Thank You for all answers and tips.
The image object in the PDF file stores only the Width and the Height of the image in pixels. In order to know the position and size of the image on the page, in PDF points, you have to execute the page content stream, to create a virtual rendering. The image is painted on the page using the 'Do' operator and its position and size are given by the current transformation matrix that is in place when the 'Do' operator is executed.
The DPI for a specific drawing instance is computed as 72*imageSizeInPixels/imageSizeInPoints, imageSizeInPoints being computed as described above.