This question already has an answer here:
How to set the page size to Envelope size with Landscape orientation?
(1 answer)
Closed 6 years ago.
I am using itext PDF, and I need to set PDF document size as German Std. Fanfold(8 1/2" x 12"),I don't know how set Inches In Itext document.
// Now I can set paper size as A4 but i need to set 8 1/2" x 12" or German Std. Fanfold size
document(name: fileName,pageSize: PageSize.A4,leftMargin:8, rightMargin:8, topMargin:8, bottomMargin:3)
Thanks in advance.
Please do yourself a favor and read the documentation!
As explained in the Getting started section, measurements are expressed in user units, and there are 72 user units in an inch, so:
8.5 inch x 72 points = 612 user units
12 inch x 72 points = 864 user units
So you need to create a rectangle like this:
Rectangle pagesize = new Rectangle(612, 864);
and a document like this:
Document document = new Document(pagesize);
edited 1/25/2021
Related
An issue with our collection view that displays the user's camera roll has appeared specifically on the iPhone 13 Pro. This includes the simulator and real device.
The layout of the cells is acting like there's a missing column in the collection view. This bug does not occur on models prior such as 12 Pro Max or SE 2nd gen.
The layout I am using is the "UICollectionViewFlowLayout" or "Flow" layout. I am wondering if this is an iOS 15 or Xcode 13 issue, or did something change elsewhere.
Here are some screenshots that showcase the issue:
iPhone 13 Pro:
iPhone 12 Pro Max:
The same code renders both of these outputs...
What could be causing this problem or where to look?
UPDATE:
The width is calculated properly:
let numberOfColumn = CGFloat(configure.numberOfColumn)
let width = (view.frame.size.width - (5 * (numberOfColumn - 1))) / numberOfColumn
As you will see in the following ss, when I select a cell (orange bordeR) it is normal size, the cell size doesn't seem to be the issue. When I click on the empty space in the middle, it does nothing, there is no cell there.
So it was the cell size being off by a fraction!
let count = CGFloat(configure.numberOfColumn) // value is always 3
let width = floor((view.frame.size.width - (5 * (count - 1))) / count)
Calling floor() on the width fixed the issue, 3 cells can now fit in screen width on 13 Pro and other models.
I Have This Questions :
1-Read the image (‘lena_gray.jpg')
2-Write the image to the disk for quality=[0 5 15 25 50];
3-Find the compression ratio for each value of quality
*I solved the first and second question
*But when I wanted to solve the last question, I did,
a)I calculated the original image size
"OriginalFileSize"
b)I calculated the size of the compressed image "CompressedFileSize" for each Qulaity But when I
calculate the "compressionRatio=OriginalFileSize/CompressedFileSize" for each Quality, I get the same
result even though the quality is different
*What is correct and how can I solve the question ?
*Is there another way to solve the 3 questions?
figure
Original=imread('lena (1).jpg')
imshow(Original)
information = imfinfo('lena (1).jpg')
OriginalFileSize=(information.Width*information.Height*information.BitDepth)/8
//for Quality 1
imwrite(Original,'CompressedQuality1.jpg','jpg','Quality',0)
CompressedFileSize1=information.FileSize
CompressedRatio1=OriginalFileSize/CompressedFileSize1
//for Quality 5
imwrite(Original,'CompressedQuality2.jpg','jpg','Quality',5)
CompressedFileSize2=information.FileSize
CompressedRatio2=OriginalFileSize/CompressedFileSize2
//for Quality 15
imwrite(Original,'CompressedQuality3.jpg','jpg','Quality',15)
CompressedFileSize3=information.FileSize
CompressedRatio3=OriginalFileSize/CompressedFileSize3
//for Qualoty 25
imwrite(Original,'CompressedQuality4.jpg','jpg','Quality',25)
CompressedFileSize4=information.FileSize
CompressedRatio4=OriginalFileSize/CompressedFileSize4
//for Quality 50
imwrite(Original,'CompressedQuality5','jpg','Quality',50)
CompressedFileSize5=information.FileSize
CompressedRatio5=OriginalFileSize/CompressedFileSize5
I want to set my FPDF paper size to 8.5 X 13 that almost the same with MS Office Word paper size. Right now I' using the following codes below.
$pdf= new PDF('P','mm','A4');
How could I set my paper size the same with that?
You can also use millimeter. You just need to convert 8.5 x 13 inch into millimeter.
You can also open MS Office Word, open word options then click on advanced. Then change the measurement unit to millimeters to see the millimeter size of the paper in MS office Word then use the size in the measurement of the following paper sizes.
$pdf= new PDF('P','mm',array(215.9,279.4));
The fpdf documentation shows that you need an array() to set custom dimensions:
$pdf = new PDF('P','in',array(8.5,13))
I'm creating a pdf report with itext and I'm having a problem. I create a line separator and immediately below I create a pdfTable. The problem is that de top border of the table is over the line separator I just created. Is any way to down a couple of lines in order to draw the next component with itext and solve this?
Thank you
Please take a look at the API documentation of the PdfPTable class. You'll fond methods such as setSpacingBefore(float spacing) and setSpacingAfter(float spacing). In you case, you could something like:
table.setSpacingBefore(6);
This will introduce a spacing of 6 user units (which by default corresponds with about 1/12 of an inch) before the table.
The spacing you need for "a couple of lines" depends on the leading. The default fonts size is 12 and the default leading is 1.5 times the font size. Two lines would be (2 x (12 x 1.5)) or 36 user units (about half an inch).
I created a 8.5x11.0 inches image # a 300dpi setting in photoshop.
When i go to use this as a background image in report designer the image looks hugeee.
It's not fitting within the 8.5x11.0 page.
Is there a way to resize this image correctly so that it will fit correctly within a 8.5x11.0 letter size page?
Thanks in advance,
with the information you gave, i believe your problem is problably in the group Size/dpi
You saved an image of size 8,5 x 11 inches # 300 Dpi (dots per inch) that calculates to aproximately an image of 2550 x 3300 pixels.
Now if your "report designer" software looks only at the size in pixels and assumes a dpi value diferent then the one you used, say for example 72 dpi, your 2550 x 3300 pixels image would actually be something like 45,8 x 35.4 inches.
So, my advice is, find out what are the characteristics your solftware is especting, aparently it is not 300dpi.
If you can´t find the information, try commonly used dpis like 72dpi or 150dpi.