Menu

White boarders after conversion to images

Help
2012-01-10
2013-04-29
  • Martin Hollerweger

    On some Pdfs i get white boarders after conversion to imagges with:
    List<Image> images = renderer.render(document, i, i);

    I think the pdfs has "cropping" infos which are should be shown or so…
    But i couldn't find an option to only render the shown part of the picture.

    Can anybody help me?

     
  • Martin Hollerweger

     
  • zippy1978

    zippy1978 - 2012-01-10

    Hi,

    What is the problem exactly: do you need to resize the output page ?

    Gilles

     
  • Martin Hollerweger

    No, i get white boarders on the images despite there are non in the original PDF.

     
  • zippy1978

    zippy1978 - 2012-01-10

    What is the original paper size ?
    Is it working better if you use the Ghostscript commande line directly ?

     
  • Martin Hollerweger

    Now i tried it with command line:

    First i had the same problem with the boarders: gswin64c -sDEVICE=jpeg -o F:\Sony\ftp\TestOutpu
    t\test-%d.jpeg F:\Sony\ftp\PDFs\incorrect\000000874643_SB_01_01-mont-gs902.pdf

    I look up for the problem and found the Solution: just adding -dUseCropBox solved my Problem.
    Would it be possible to add this in the library??…

    Thanks for your quick answers.

     
  • zippy1978

    zippy1978 - 2012-01-10

    I need to add the parameter to the SimpleRenderer… I will do this as soon as I can.
    You can also add it yourself in SimpleRenderer Java…

     
  • Martin Hollerweger

    okay, I just changed the parameters. Here is the code:
      //prepare args
            String gsArgs = {
                "-dQUIET",
                "-dNOPAUSE",
                "-dBATCH",
                "-dSAFER",
                "-dFirstPage=" + (begin + 1),
                "-dLastPage=" + (end + 1),
                "-dUseCropBox",
                "-sDEVICE=display",
                "-sDisplayHandle=0",
                "-dDisplayFormat=16#804",
                "-r" + this.getResolution(),
                "-f",
                diskStore.getFile(inputDiskStoreKey).getAbsolutePath()};

    Here the explanation -dUseCropBox
    Sets the page size to the CropBox rather than the MediaBox. Some files have a CropBox that is smaller than the MediaBox and may include white space, registration or cutting marks outside the CropBox. Using this option will set the page size appropriately for a viewer.

    Thank you!

     

Log in to post a comment.