-
-
Notifications
You must be signed in to change notification settings - Fork 579
Description
Hello. I'm trying to create pdf out of json file.
I'm looking for a way to set the custom page size, but unable to find it and start looking into standard sizes provided with parameter paper. And I found what I'm looking for. Format "Letter", however standard of letter has dimensions of 612x792 but in pdfcpu it has size 612x791. May you advice is that a bug?
And is there any way to set the custom size?
Also would be interesting to know, how to set media box.
Here is my json
{
"origin": "UpperLeft",
"paper": "Letter",
"pages": {
"1": {
"paper": "Letter",
"content": {
"paper": "Letter",
"width": 612,
"height": 792,
"image": [
{
"src": "image.png",
"pos": [
0,
0
],
"width": 612,
"height": 792
}
]
and later there is only pure text create with absolute position.
And in log I see
WRITE: 2024/04/07 15:16:11 writePagesDict: writing pageDict for obj=2 page=1
<<
<Count, 1>
<Kids, [(6 0 R)]>
<MediaBox, [0.00 0.00 595.00 842.00]>
<Type, Pages>
>>
WRITE: 2024/04/07 15:16:11 addToObjectStream begin, obj#:2 gen#:0
TRACE: 2024/04/07 15:16:11 FindTableEntry: obj#:8 gen:0
TRACE: 2024/04/07 15:16:11 FindTableEntry: obj#:2 gen:0
TRACE: 2024/04/07 15:16:11 AddObject end : ObjCount:3 prolog = <6 0 4 243 2 315> Content = <<</Contents 5 0 R/CropBox[0.000000000000 0.000000000000 612.000000000000 791.000000000000]/MediaBox[0.000000000000 0.000000000000 612.000000000000 791.000000000000]/Parent 2 0 R/Resources<</Font<</F0 4 0 R>>/XObject<</Im0 3 0 R>>>>/Type/Page>><</BaseFont/Helvetica/Encoding/WinAnsiEncoding/Subtype/Type1/Type/Font>><</Count 1/Kids[6 0 R]/MediaBox[0.000000000000 0.000000000000 595.000000000000 842.000000000000]/Type/Pages>>>
I don't understand where is this media box comes from <MediaBox, [0.00 0.00 595.00 842.00]>, as I have another sizes. I'm trying to solve the issue of correctly positioning text, but my text for some reasons misaligned originally it must be around 15 point lower, trying to recreate pdf after OCR.