Open yinso opened 7 years ago
the shortest path to success is o add true
as an additional parameter to PDFPageModifier
constructor. This will kill any side effects of the existing content, and you can add your content being sure that you control the matrix, color or whatnot.
make this:
var modifier = new hummus.PDFPageModifier(writer, 0);
become this:
var modifier = new hummus.PDFPageModifier(writer, 0,true);
Hi,
I tried this on the test.pdf
mentioned in #144 and it works, however, for my original source file it still appears to have the same issue, so perhaps my original source file wasn't in landscape mode.
As the original source pdf is confidential in nature, I cannot just link it here. Is there another way of providing it to you? Thanks.
i'm not sure that i understand the problem then. Let me describe what i understand in my words, so you can either confirm, or tell me what's different from what you see:
well. if that's true than it goes against my understanding on how things work in PDF files in general, and i will definitely need the file. either this, or you can debug this and get to tell me what's going on. or just rotate the text to be the way that you want it to be using the cm operator.
you can send me the file via gal.kahana@hotmail.com. if you deem it necessary i can also sign an nda.
Yes your understanding is correct. I agree it looks very weird and given that I only have high level knowledge of PDF I am not sure how I would go about debugging at this point, so definitely highly appreciative of you helping to look into this.
One interesting side point - based on what you are saying, is portrait vs landscape as simple as a comparison of the width vs the height and see which side is larger? I.e. is there no place in PDF that specify the orientation in terms of a default rotation, i.e. does x grow on the width side or the height side?
I'm sending the file to your email address in the next few minutes. Again - thank you very much for the help to look into this.
ok. got the file. everything is actually fine and works as expected actually. the page is using a "rotate" parameter that is set to 90. This means that the whole page is rotated in 90 degrees - contents, dimensions the lots.
If you want to align anything that you'll add to the rotated form of the page, you'll have to take that into account, or change the page orientation.
you can get that info with page parsing: https://github.com/galkahana/HummusJS/wiki/Parsing#page-info-objects
Hi,
I'm trying to modify an existing PDF file, which happens to be oriented to landscape mode.
When I run the sample code below.
It turns out that the text
Test me out
gets written to the top left corner vertically, which is of a different orientation from the rest of the page, instead of the expected bottom left corner horizontally.Is there a way for me to 1) detect the orientation of the page, and/or 2) create the modify context with the same orientation as the page, and/or 3) arbitrarily change the orientation of the context?
Thanks for your help.