Log of #ghostscript at irc.freenode.net.

Search:
 <<<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 origin14:06.58 
  You could also try setting PageOffset in the page device dictionary14: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 a414: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 dictionary14: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 tried14: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 before14: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 work14: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 thing14:17.38 
lilltiger ohh it has to been inbetween the outout and input?14:19.20 
  output14:19.28 
kens Before the input, usually after the output. but not necessarily so14: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.pdf14: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 -o14: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 complains14:21.49 
lilltiger well now i end up with a white page14:24.07 
kens Well, withtout seeing your input file, I can't tell if that's to be expected14:24.28 
lilltiger let see if i can get a link to it then14:25.03 
  https://dev.plastprint.se/index.php/sv/DownloadPDF?&design_id=214:26.00 
kens Wnats me to login (I think) my Swedish isn't up to reading it properly14:26.44 
lilltiger that will download you the pdf that i want to place onto an a414:26.50 
  ohh hmm14:26.58 
  try now14:27.26 
kens Still takes me to a login screen14:27.53 
lilltiger how about now? :)14:30.03 
kens OK I have the file14:31.31 
  Will need a minute14:31.36 
lilltiger afk 5min then wc :)14:32.58 
kens So the default is to produce a page 4.93x6.36 inches14:34.03 
  Ah, it looks like the problem is you forgot the -f after the PostScritp14:36.00 
lilltiger i tried with the -f as well when i used the .ps file14: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.pdf14:37.41 
  lilltiger: does that work for you ?14:42.06 
lilltiger awsome got it to work :)14:42.08 
kens Great14:42.11 
lilltiger now I need to figure out how begin page works :)14:43.12 
kens Ah, that's a little more complex14:43.27 
  It takes a PostScript procedure, so you'll need to write some PostScript14: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 a414:44.28 
kens Yes that's true. Also each page can be a different size14:44.48 
  But extracting the media sizes for each page isn't trivial14: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 notice14:45.37 
  What you coudl do is override setypagedevice, check for calls which have a /PageSize key14:46.16 
lilltiger well I already have some programs that i cant update14:46.24 
kens That would then allow you to remove the key/value pair, and use the value to set up a /PageOffset instead14:46.38 
lilltiger hmm, wouldent it be easier to get the size of the input file insted and manipulate the offset then14:47.57 
kens Each page in a PDF file may have a differnt MediaBox14: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 page14:48.52 
chrisl Would setting the PageSize Policy be sufficient?14:48.54 
lilltiger it's only 1 page14:48.55 
kens Well, that counts as special knowledge I guess14:49.13 
  chrisl It might work yes14:49.23 
  I've not tried it14:49.28 
chrisl It would scale the content, though14:49.43 
lilltiger chrisl: then itäs not an option14: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 all14: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 PDF14:51.18 
kens Doesn;t look liek there's a center but no fit14:51.34 
  Looks like PageSizePolicy isn't going to help, and you can't use PDFFitPage, so you'll have to do it manually14:52.51 
lilltiger seems like the easiest way it to get the size of the org pdf, and then just calculate the offset needed14: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-file14:54.11 
kens Fair enogh then14: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 one14:55.27 
  Thanks for the help this far!14:56.20 
kens NP14:56.26 
lilltiger time to go home, work day is over ;D14:56.35 
kens wishes it were so14:56.47 
Robin_Watts Ok, so if the jar file doesn't build, you get compileFail: mupdf.jar17:54.56 
  If the jni file doesn't build you get compileFail: mupdf.jni17: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)>>> 
ghostscript.com #mupdf
Search: