| <<<Back 1 day (to 2018/10/03) | 20181004 |
lilltiger | How can I change where the pdfwriter places things smaler then the given area, i use "-sPAPERSIZE=a4 -dFIXEDMEDIA" and often have stuff that is smaller then an a4, and i want this to be placed in the upper left corner. But by default gs places it in the lower left. So how do i change this? | 13:44.25 |
kens | You need to set a BeginPage procedure in PostScript and translate the origin | 14:06.58 |
| You could also try setting PageOffset in the page device dictionary | 14:08.01 |
lilltiger | I have tried to load a ps that does stuff, like: gs -sPAPERSIZE=a4 -dFIXEDMEDIA -dColorConversionStrategy=/LeaveColorUnchanged -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sOutputFile='out.pdf' 'fixpos.ps' -f 'in.pdf' | 14:11.43 |
| but this just gives me a white a4 | 14:11.50 |
kens | Like I sadi, you either need to set a BeginPage procedure which shifts the origin on eah cpage, or set PageOffset in the page device dictionary | 14:12.21 |
lilltiger | yes, how do i set PageOffset if it dosent seem to work to load a .ps in companion with my pdf? | 14:13.38 |
kens | You haven't given me an example file to work from or a complete description of what you have tried | 14:14.29 |
lilltiger | and also the -c stuff either does nothing (if placed last) or produce an error that no outfile was provided (thought it is) like -c '<</Orientation 2>> setpagedevice' | 14:14.33 |
kens | THis is known to work. I've done it before | 14:14.38 |
lilltiger | https://superuser.com/questions/440146/resize-a4-pdf-to-sra4-and-center-content << I have tried this to see if I could get it to move, I know itäs not BeginPage, but I wanted to see if I could get the -c stuff to work | 14:16.58 |
kens | Since -c introduces PostScript its important to get it in the right place on the command line. It has to be *before* hte input file for one thing | 14:17.38 |
lilltiger | ohh it has to been inbetween the outout and input? | 14:19.20 |
| output | 14:19.28 |
kens | Before the input, usually after the output. but not necessarily so | 14:19.44 |
lilltiger | gs -sPAPERSIZE=a4 -dFIXEDMEDIA -dColorConversionStrategy=/LeaveColorUnchanged -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -c '<</PageOffset [21 32]>> setpagedevice' -o pdf2 -f test.pdf | 14:20.35 |
| this gives me the error: GPL Ghostscript 9.25: Device 'pdfwrite' requires an output file but no file was specified. | 14:20.51 |
kens | Then put the -c after the -o | 14:21.06 |
| When you call setpagedevice it erases the page (to white) which causes the pdfwrite devce to try to access the otuptu file. Since you ahevn'[t set one at that point, it complains | 14:21.49 |
lilltiger | well now i end up with a white page | 14:24.07 |
kens | Well, withtout seeing your input file, I can't tell if that's to be expected | 14:24.28 |
lilltiger | let see if i can get a link to it then | 14:25.03 |
| https://dev.plastprint.se/index.php/sv/DownloadPDF?&design_id=2 | 14:26.00 |
kens | Wnats me to login (I think) my Swedish isn't up to reading it properly | 14:26.44 |
lilltiger | that will download you the pdf that i want to place onto an a4 | 14:26.50 |
| ohh hmm | 14:26.58 |
| try now | 14:27.26 |
kens | Still takes me to a login screen | 14:27.53 |
lilltiger | how about now? :) | 14:30.03 |
kens | OK I have the file | 14:31.31 |
| Will need a minute | 14:31.36 |
lilltiger | afk 5min then wc :) | 14:32.58 |
kens | So the default is to produce a page 4.93x6.36 inches | 14:34.03 |
| Ah, it looks like the problem is you forgot the -f after the PostScritp | 14:36.00 |
lilltiger | i tried with the -f as well when i used the .ps file | 14:37.09 |
kens | Yes, that works for me, you need something like: | 14:37.41 |
| gs -sPAPERSIZE=a4 -dFIXEDMEDIA -sDEVICE=pdfwrite -sOutputFile=\temp\out.pdf -c "<</PageOffset [21 32]>>setpagedevice" -f testrc2_06-03-08.pdf | 14:37.41 |
| lilltiger: does that work for you ? | 14:42.06 |
lilltiger | awsome got it to work :) | 14:42.08 |
kens | Great | 14:42.11 |
lilltiger | now I need to figure out how begin page works :) | 14:43.12 |
kens | Ah, that's a little more complex | 14:43.27 |
| It takes a PostScript procedure, so you'll need to write some PostScript | 14:43.39 |
| Isn't PageOffset enough ? | 14:43.46 |
lilltiger | well, what if the pdf is in another size? | 14:44.14 |
| they vary and some are an exact fir for a4 | 14:44.28 |
kens | Yes that's true. Also each page can be a different size | 14:44.48 |
| But extracting the media sizes for each page isn't trivial | 14:45.03 |
| It measn messing about with bit sof the PDF interpreter we don't really expect people to touch. So its liable to change without notice | 14:45.37 |
| What you coudl do is override setypagedevice, check for calls which have a /PageSize key | 14:46.16 |
lilltiger | well I already have some programs that i cant update | 14:46.24 |
kens | That would then allow you to remove the key/value pair, and use the value to set up a /PageOffset instead | 14:46.38 |
lilltiger | hmm, wouldent it be easier to get the size of the input file insted and manipulate the offset then | 14:47.57 |
kens | Each page in a PDF file may have a differnt MediaBox | 14:48.25 |
| So unless you have special knowledge that this won;t ever be the case, no, its better to do it on the fly for each page | 14:48.52 |
chrisl | Would setting the PageSize Policy be sufficient? | 14:48.54 |
lilltiger | it's only 1 page | 14:48.55 |
kens | Well, that counts as special knowledge I guess | 14:49.13 |
| chrisl It might work yes | 14:49.23 |
| I've not tried it | 14:49.28 |
chrisl | It would scale the content, though | 14:49.43 |
lilltiger | chrisl: then itäs not an option | 14:49.52 |
kens | No, you can choose 'select nearest and center' can't you ? | 14:50.00 |
lilltiger | the size is crucial, cant be changed at all | 14:50.13 |
| kens: in this case i actualy know that it ever only be 1 page. as it's an SVG that I am converting to PDF | 14:51.18 |
kens | Doesn;t look liek there's a center but no fit | 14:51.34 |
| Looks like PageSizePolicy isn't going to help, and you can't use PDFFitPage, so you'll have to do it manually | 14:52.51 |
lilltiger | seems like the easiest way it to get the size of the org pdf, and then just calculate the offset needed | 14:53.22 |
kens | Up to you, not sure how you plan to get the original size. | 14:53.44 |
lilltiger | I should have it in my svg-file | 14:54.11 |
kens | Fair enogh then | 14:54.26 |
lilltiger | or use imagick on the svg, hmm.. I just rememberd that only a few of the svg's have the pdf-file layer.. well maybe have to enforce that there should be one | 14:55.27 |
| Thanks for the help this far! | 14:56.20 |
kens | NP | 14:56.26 |
lilltiger | time to go home, work day is over ;D | 14:56.35 |
kens | wishes it were so | 14:56.47 |
Robin_Watts | Ok, so if the jar file doesn't build, you get compileFail: mupdf.jar | 17:54.56 |
| If the jni file doesn't build you get compileFail: mupdf.jni | 17:55.10 |
| It's only tested on miles, so you'll have to look at the miles logs that should be included. | 17:55.42 |
| I wonder if we should have an "all-but-gl" target in the Makefile that we can use to avoid the compilations always failing on that. | 17:56.42 |
| Currently we build "all", and the gl targets fail. We don't detect that as a failure though, cos we still get our mutool binaries produced. | 17:57.28 |
tor8 | Robin_Watts: make all HAVE_GLUT=no maybe? | 22:01.48 |
| Forward 1 day (to 2018/10/05)>>> | |