开发者

processing: generated pdf cut off at y=1000

开发者 https://www.devze.com 2023-03-07 10:34 出处:网络
I generate a pdf with this size in processing (using eclipse): size(1200, 2000, PDF, "testruns.pdf");

I generate a pdf with this size in processing (using eclipse): size(1200, 2000, PDF, "testruns.pdf");

My problem is, that the pdf only contains the content that is smaller that the y coordinate of 1000.

Everything below this is not displayed in the resulting graph.

To illustrate: the final line lines should more or less touch the right bottom of my pdf. Instead they are cut off at the middle because my pdf just ends there.

 for (int i = 0; i < p.height; i++) {
    if (i%10==0)
       p.line(0,0,p.width,i);
 } 

Where can i alter this 1000 limit?

edit: Instead of the lines looking like this:

1

********                                                                  
 *******                                                                  
   *****                                                                  
     ***                                                                  
       *   

they look like this:

2

********                                                                  
 *******                                                                  
   *****                                                                  
                                                                
                                                    
        

edit: here is the pdf, you can see the error in it. I used the code snippet provided by George Profenza to generate the pdf. It illustrates my problem quite nicely.: http开发者_如何转开发s://rapidshare.com/files/2041623366/testruns_simpletest.pdf cheers


I can't seem to replicate you're issue. I've used your code in two similar instances and they worked fine:

package pdftest;

import processing.core.PApplet;

public class PDFTest extends PApplet {

    public void setup() {
         size(1200, 2000, PDF, "testruns.pdf");
         noLoop();
         for (int i = 0; i < height; i++) if (i%10==0) line(0,0,width,i);
         exit();
    }

}

and

package pdftest;

import processing.core.PApplet;

public class PDFTest2 extends PApplet {

    public void setup() {
        size(1200, 2000);
        noLoop();
        beginRecord(PDF, "filename.pdf");
        for (int i = 0; i < height; i++) if (i%10==0) line(0,0,width,i);
        endRecord();
    }

}

Both run well.

Also, I've noticed you use p.height, p.line(, etc. which makes me think you're creating an instance of a PApplet inside another Applet of some sort, but can't work out much more since I can't see the code. Try the basic I've provided, which are also available as a zipped eclipse project.

Maybe there is something in the way somewhere in the applet that contains your PApplet instance, or the dimension of the 'container' applet do not match the ones of the PApplet instance, not sure.

UPDATE:

I've tested both of my applets using eclipse helios and core.jar from Processing 1.5.1 on Windows XP.

PDFTest rendered a pdf with the same problem you mentioned, so I was able to replicate the issue. I am not sure why this happens, as it happens on Windows, not OSX.

PDFTest2 rendered the pdf correctly, but I did get a warning in the console:

isRecording(), or this particular variation of it, is not available with this renderer.

Not sure what that means to be honest. @nemoo Does PDFTest2 generate the correct pdf on your machine as well ?

0

精彩评论

暂无评论...
验证码 换一张
取 消